BBC micro:bit – Stopwatch

stopwatch-micro-bitIn this challenge we are going to create a Stopwatch (Countdown timer) using the BBC micro:bit.

You do no need a micro:bit to complete this challenge as you can use the online block editor and emulator (www.microbit.co.uk) to code and test your program.

Our program will use both input buttons A and B and the LEDs for as an output:

  • Button A will be used to initialised the stopwatch. Per default the stopwatch will be set at 3 seconds. By pressing button A, the user should be able to increment this value by 1 second at a time.
  • Button B will be used to start the count down. Once this button is pressed the stopwatch should automatically decrement by 1 every second and it should stop when it reaches the value 0 (zero).
  • The LEDs should be used to display the countdown value.

micro-bit-3

Step by Step Solution


Watch this step by step video tutorial to complete the code of your stopwatch.

Extension Task


Option 1:
Can you update this code further so that when both buttons A and B are pressed at the same time, the timer is paused.

Option 2:
Can you update this code so that when the timer reaches zero (0), it displays the text “Happy New Year!”.

Share Button
Posted in BBC micro:bit, Computer Science Tagged with: