Example Code for micro:bit-Guard Security
This article introduces example code for creating a security system using micro:bit, detailing hardware and software preparation, wiring diagrams, and providing sample codes for programming on Mind+ and MakeCode platforms, enhancing DIY projects with security features.
Hardware Preparation
![]() |
![]() |
![]() |
|---|---|---|
| BOS0045 Ultrasonic Distance Sensor | BOS0017 LED Module | BOS0032 Threshold Module |
![]() |
![]() |
![]() |
| MBT0039 micro:bit | BOS0040 micro:bit BOSON Expansion Board | BOS0035 Mainboard-3IO |
![]() |
||
| BOS0029 Logic Module-NOT |
Software Preparation
Mind+ and MakeCode graphical programming platforms.
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.
Result
Video Demo
| Non-programming | Programming |
|---|---|
![]() |
![]() |
Additional Information
Program Flowchart:

Was this article helpful?









