Example Code for micro:bit-Button-controlled Fan
This blog post offers example code and comprehensive guidance on using a micro:bit to control a fan with button inputs, including hardware setup, software preparation, wiring diagrams, and programming flowcharts, enabling users to learn and build interactive projects.
Hardware Preparation
![]() |
![]() |
![]() |
|---|---|---|
| BOS0021 Fan Module | MBT0039 micro:bit | BOS0040 micro:bit BOSON Expansion Board |
Wiring Diagram
Connection Diagram

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

Was this article helpful?




