Example Code for micro:bit-MakeCode-Security Alarm
This article provides a step-by-step guide on setting up a security alarm using micro:bit and MakeCode, including hardware components like jumper wires and a buzzer, software preparation, wiring diagram, and sample code.
Hardware Preparation
- Components: two jumper wires, one buzzer.
- Pin P0 will be used in this project.
Software Preparation
- Makecode: Click to enter makecode online programming environment: https://makecode.microbit.org/
Wiring Diagram

Sample Code
- Screenshot of makecode graphical codes:

Result
Turn on the power, the buzzer starts playing.
Was this article helpful?
