Skip to main content

Case 27: The Smart Garbage Can

Purpose


Make a smart garbage can.


micro:bit Wonder Building Kit

Materials Required


Bricks build-up


Installation Mthods of Hardwares

Install the sonar:bit with the bricks.

Hardware Connection

Connect a servo to S0 and a sonar:bit to P0 port on Wukong breakout board.

Software Platform


MakeCode

Coding


Add extensions

Click "Advanced" in the MakeCode to see more choices.

Search with Wukong in the dialogue box to download it.

Search with IOT:bit in the dialogue box to download it.

Program

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

Result

When the micro:bit is powering on, it displays a heart icon, then the lid will automatically open when the ultrasonic sensor detects someone approaching, and it will automatically close after three seconds.