Example Code for micro:bit-Colorful Lights
When the touch sensor detects a touch, the micro:bit displays a "heart" pattern, and the red, blue and green LEDs blink in order to present a water flow lighting effect. When no touch is detected, all LEDs turn off and the micro:bit display a "square" pattern.
Hardware Preparation
![]() |
![]() |
![]() |
|---|---|---|
| BOS0008 Touch Sensor | BOS0017 Red/Blue/Green LED Module | MBT0039 micro:bit |
![]() |
||
| BOS0040 micro:bit BOSON Expansion Board |
Software Preparation
MakeCode, Mind+
Wiring Diagram

Result
Video Demo:
| Programming |
|---|
![]() |
Additional Information
Flowchart:

Was this article helpful?





