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 BOS0017 mbt0039
BOS0008 Touch Sensor BOS0017 Red/Blue/Green LED Module MBT0039 micro:bit
BOS0040
BOS0040 micro:bit BOSON Expansion Board

Software Preparation

MakeCode, Mind+

Wiring Diagram

Connection 4

Result

Video Demo:

Programming
Demo 4

Additional Information

Flowchart:

flowchart 4

Was this article helpful?

TOP