Example Code for micro:bit-Rotated Circular Light

The 9 RGB LEDs display 9 colors (gradients), and then on the lamp ring the nine RGB LEDs display the 9 colors in a continuous loop just like a waterfall light. Modify the color behind the show color to get other solid color rotation effects.

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: The Graphic Programming of Rotated Circular Light

Light up 9 LEDs from the No. 0 LED and the color range 0~255.

Set the brightness of the LED to 100

Set the rotation speed

For solid color rotation effect:

Click and enter the graphic programming:Yellow Rotating Circular Light

solid color

Result

  • Gradient rotation effect: The 9 RGB LEDs display 9 colors (gradients) in a continuous loop just like a waterfall light.
    Rotated Circular Light
  • Solid color rotation effect: The 9 RGB LEDs display a solid color in a continuous loop.

Additional Information

Modify the color behind the "show color" block to get other solid color rotation effects.

Was this article helpful?

TOP