On Windows, be sure to put the files in a folder under users/”Username”/mu-code for them to be detected my mu-editor

These files are the modules that are not originally present on the micro:bit for you to import.

Step 3 – Loading Screens

This step isn’t really necessary , but it adds a little flair into your project.

We display this loading on the OLED module

Using the module “add_text”, we can display text and other characters onto the display

We show the animation using the function “loading_screen()”

If you want more variations of the loading screen, head down to the bottom of the post.

Step 4 – Code the Game

Here’s the actual test itself.

First, we have to have a time to wait before showing the indicator for the player to press the button

We randomly generate the number and parse it into milliseconds by adding “000” to the end of the number after turning the original number into a string.

The variables time1 and time2 refer to 2 arbitrary points in time before the “#” ( the indicator to the player) symbol is shown.

One quirk about micropython and the MicroBit to note is that the time module is replaced by the utime module, and utime has to be imported instead of time.

Step 5 – A Little More Logic

This is the step where we calculate and display the player’s reaction time.

This is done by calculating the time between when the indicator is displayed and when the player presses the button.

Then, we display the player’s reaction time to the OLED display.

Bonus loading effects:

This one utilizes the light sensor and the LED to start the game.

It detects light and once the light is covered, the game will start.

This next animation is simple: display the characters “3”, “2” , and “1”, as a countdown before starting the game. The code is pretty self explanatory.

We're Done!

Looking for more projects to tinker and explore? We're a launch partner for IMDA's Digital Maker Programme, where we've been developing micro:bit kits, apps, and conducting workshops for schools and the public in Singapore. Read more here, and get in touch if you'd like to join our workshops!

About Tinkercademy

We’re coders and tinkerers who teach coding and tinkering to schools, corporations, and the public in Singapore. We bring an unparallelled depth of experience in education and technology to our classes and curriculum.