Reaction timer - BBC micro:bit
Output is via the serial port, so you can
- Run it with mu and use mu's REPL to display the results, or
- Connect it to a Raspberry Pi or some other computer and do something interesting with the output!
What does it do?
- The program starts by displaying a clock image.
- Next, it picks a random time to wait, ranging from 500 ms to 4500 ms.
- When the time has run out it displays a happy face.
- It waits to see how long you take to press button a on the micro:bit, and prints the time in tenths of a second.
- If you press button a before the happy face is displayed it will tell you that you are naughty!
- It loops back and starts again.
You can quit the program at any time by pressing button b.
Here's some sample output displayed in mu's REPL: