"It’s Here! The BFCM Sale of the Year – Grab Your Favorites!"

The Anti-theft Device

Purpose

The anti-theft device is able to alarm with sound and lights while the objects put above the device are taken away.

Materails

micro:bit x 1

Nezha expansion board x 1

Crash sensor x 1

OLED display x 1

LED-red x 1

RJ11 wire x 3

Bricks x N

Assembly steps

Build a device as the picture shows:

Hardware Connections

Connect the crash sensor to J1 port, red LED to J2, and OLED to IIC port on Nezha expansion board.

Software programming

Go to MakeCode editor:(https://makecode.microbit.org/#editor)Click settings on the left top to choose extensions in the menu to add the package.

Search with Planet X in the dialogue box and add it to the package.

In forever brick, if the crash sensor connecting to J1 port detects the status of being pressed, set the OLED display text: “your treasure is safe”, and set the led connecting to J2 port in off status.

In forever brick, if the crash sensor connecting to J1 port detects the status of not being pressed, set the OLED display text: “your treasure not safe”, and set the led connecting to J2 port in on status and alarm.

Completed code:

Link:https://makecode.microbit.org/_7rjPTKcvpJvM

Result

The anti-theft device will alarm and flash on if the objects placed above it are taken away.

Leave a Reply

images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
images
Children’s Programming Education is the Future Trend
images
Technical verification! Nezha series products can complete WRO competition tasks
images
Let's take part in the Ceremony of the New Factory of ELECFREAKS together!
images
Bluetooth Bee(HC-05 and HC-06) User Guide
images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
Monthly Archive