Example Code for micro:bit-Detect Metal Object
Explore how to use micro:bit to detect metal objects with example code, wiring diagrams, and setup tips. This guide covers hardware and software preparation, along with detailed instructions for both programming and non-programming connections, making it ideal for electronics beginners.
Hardware Preparation
![]() |
![]() |
![]() |
|---|---|---|
| BOS0012 Conductivity Switch | Alligator Clip | BOS0020 Buzzer Module |
![]() |
![]() |
![]() |
| BOS0035 Mainboard-3IO | MBT0039 micro:bit | BOS0040 micro:bit |
Tips: micro:bit and Micro:bit BOSON expansion boards are used in the programming example.
Wiring Diagram
Non-programming Sample Connection

Programming Sample Connection

Result
When the conductivity sensor detects a conductive object, the buzzer will sound.
Additional Information
Flow Chart:

Was this article helpful?






