Example Code for micro:bit-Breathing Light

24 RGB LEDs light up red at the same time, the brightness changes from weak to strong in loop, like breathing.

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:Breathing Light

Result

24 RGB LEDs light up red simultaneously, with brightness cycling from weak to strong like breathing.

Breathing Light

Was this article helpful?

TOP