Example Code for micro:bit-LED Brightness Control
This article provides a detailed guide on controlling LED brightness using micro:bit, featuring hardware and software preparations, wiring diagrams, and sample code, making it accessible for anyone to start programming with micro:bit and RGB LED strips.
Hardware Preparation
![]() |
![]() |
|---|---|
| BOS0001 Rotation Sensor | M011.00184 RGB LED Strip |
![]() |
![]() |
| MBT0039 Micro:bit | BOS0040 Micro:bit BOSON Expansion Board |
Software Preparation
Before using the colorful light strip, load the library in Mind+. Open the Mind+ programming platform, find the "Extension" in the lower left corner and click it, then click the WS2812 RGB light in the "display" to load the relevant commands. At this time, the display module will appear in the command area. After completing the above steps, connect the light strip to the micro:bit board to control the effect of the light strip through programming.
Wiring Diagram

Other Preparation Work
Flow Chart:

Sample Code
Mind+ Sample Program:
Makecode Sample Program:
Result
Demo Videos:
| Programming |
|---|
![]() |
Was this article helpful?





