Example Code for micro:bit-Tomato Timer

Press key A to start the program and light a LED on the main board in every minute. When all LEDs are on, the buzzer beeps; When key B is pressed, stops the buzzer and stops timing. The circular light refreshes the color in every second. The Pomodoro technique is a simple time management method (25-minute work period).

Hardware Preparation

  • micro:bit main board ×1
  • ROB0150 24 RGB LEDs Circular Expansion Board ×1
    (Purchase Link)
  • USB cable ×1

Software Preparation

  1. Development Tool:
    MakeCode
    https://makecode.microbit.org

  2. Add the Neopixel Software Package
    Load the neopixel library to control the LED ring.

Other Preparation Work

Add the neopixel software package (loading the lamp ring library) in Makecode; the steps are as follows:

Add the software package

Sample Code

Click and enter the graphic programming:Tomato Timer

Set Dot Matrix

Set Time

Set the Effect

Result

  • Press key A: Starts timing, lights one LED on the micro:bit every minute, and circular light refreshes color every second.
  • When minutes=25: All micro:bit LEDs are on, buzzer beeps.
  • Press key B: Stops buzzer and timing.

Tomato Timer

Additional Information

Calculation formula for the time interval between each RGB LED: 6000ms (1min) / 24 (24 RGB LEDs) / 60 (repeat 60 times) ≈41ms.

Was this article helpful?

TOP