Example Code for micro:bit-Variable Speed Fan
This article offers a comprehensive guide on controlling a variable speed fan using micro:bit, including hardware and software setup, wiring diagrams, and sample codes for both non-programming and programming projects using Mind+ and MakeCode.
Hardware Preparation
![]() |
![]() |
![]() |
|---|---|---|
| BOS0001 Rotation 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:

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

Was this article helpful?







