This will be my first application for the Micro:Bit and my first Internet of Things type application from idea to delivery.
Simple. I get bored easily. While doing the bedtime ritual I am not sure that I or the small person I am cajoling to bed are actually spending enough time brushing our teeth. We could simply put a clock in the bathroom but better still we can make a device that counts down 3 minutes and reminds us what we should be brushing?
I had a micro:bit left over from my Hack Day’s and just needed to decide how to code the device. As I was waiting for jury service I tried connecting with using my iPhone which worked great. However, I found the Microsoft Touch Develop a little too difficult to navigate. Once I was back at home I played with the various other IDE’s. I toyed with the idea of using mbed a platform and operating system for Internet-connected devices based on 32-bit ARM Cortex-M microcontroller.
However, I settled for the Microsoft Touch Developer as is code (rather than drag and drop based) and has a nice debug visual of the micro:bit.
My dentist would have been an ideal person to ask but as she wasn’t around I used a paste manufacturer to define the intervals of what should be brushed.
Trial and Error
I had a few attempts at creating the code. Setting a variable for the count down and then showing a message at certain points. The logic was sound but the code circular and unwieldy. Until I discovered the Games functions.
There are two that we need.
- Game start countdown. You can set a value in milliseconds to determine the duration of the game. In this case 3 minutes if teeth brushing equals 180000 milliseconds. .
- Game is running. This returns a boolean value of yes or no.
Using these the applicaton worked a treat and was about two lines of code. So gergeous.
Update : In the end I joined the Micro:Bit Educational Foundation as an Advior and on my first the CEO’s daughter decide to take on the challenge for me…