Example Code for micro:bit-Sound Control Circular Light

Light up 24 RGB LEDs in sequence according to the size of the detected sound, forming a gradual pulsating light ring.

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 Graphical Programming of Voice Control Circular Light

Result

The 24 RGB LEDs light up in sequence according to the size of the detected sound, forming a gradual pulsating light ring.

Sound Control Circular Light

Additional Information

By modifying the "Map" to change the relationship between sound intensity and the number of alight leds. 0~300 represents the range of sound; 0~23 represents 24 RGB LEDs.

Was this article helpful?

TOP