Code Example for micro:bit-Variable Speed Fan
Last revision 2025/12/08
Rotate the konb to different angle to control the speed of the fan. Clockwise rotate to increase the speed; counter-clockwise rotate to decrease it.
Hardware Preparation
![]() |
![]() |
|---|---|
| BOS0001 Rotation Sensor | BOS0021 Fan 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?





