Example Code for micro:bit-Touch-controlled Fan
The article demonstrates how to create a touch-controlled fan using micro:bit, providing detailed instructions for hardware setup, software preparation, and programming with sample code for both non-programming and programming projects, making it accessible for DIY enthusiasts and beginners in electronics.
Hardware Preparation
![]() |
![]() |
![]() |
|---|---|---|
| BOS0008 Touch Sensor | BOS0021 Fan Module | BOS0035 Mainboard-3IO |
![]() |
![]() |
|
| MBT0039 micro:bit | BOS0040 micro:bit BOSON Expansion Board |
Wiring Diagram
Non-programming Project
Connection Diagram:

Programming Project
Connection Diagram:

Other Preparation Work
Tip: micro:bit and its expansion board will be used in programming projects.
Sample Code
Mind+ Sample Code:
MakeCode Sample Code:
Result
| Non-programming | Programming |
|---|---|
![]() |
![]() |
Additional Information
Program Flowchart:

Was this article helpful?







