Code Example for micro:bit-Make a Lamp

Use the rotation sensor to control the brightness of the LED module. Clockwise rotate to brighten the lamp, counter-clockwise to darken it.

Hardware Preparation

BOS0001 Rotation Sensor BOS0017 LED module
MBT0039 Micro:bit BOS0040 Micro:bit BOSON Expansion Board

Software Preparation

Development tools: Mind+ or Makecode.

Wiring Diagram

Sample Code

Mind+ Sample Program:

Result

Demo Videos:

Programming

Additional Information

Flow Chart:

Was this article helpful?

TOP