29. Case 27: The Smart Garbage Can#

29.1. Purpose#


Make a smart garbage can.

../../_images/Wonder-Building-Kit-case-27-01.png

29.3. Materials Required#


../../_images/Wonder-Building-Kit-step-case-27-01.png

29.4. Bricks build-up#


../../_images/Wonder-Building-Kit-step-case-27-02.png

../../_images/Wonder-Building-Kit-step-case-27-03.png

../../_images/Wonder-Building-Kit-step-case-27-04.png

../../_images/Wonder-Building-Kit-step-case-27-05.png

../../_images/Wonder-Building-Kit-step-case-27-06.png

../../_images/Wonder-Building-Kit-step-case-27-07.png

../../_images/Wonder-Building-Kit-step-case-27-08.png

../../_images/Wonder-Building-Kit-step-case-27-09.png

../../_images/Wonder-Building-Kit-step-case-27-10.png

../../_images/Wonder-Building-Kit-step-case-27-11.png

../../_images/Wonder-Building-Kit-step-case-27-12.png

../../_images/Wonder-Building-Kit-step-case-27-13.png

../../_images/Wonder-Building-Kit-step-case-27-14.png

../../_images/Wonder-Building-Kit-step-case-27-15.png

../../_images/Wonder-Building-Kit-step-case-27-16.png

../../_images/Wonder-Building-Kit-step-case-27-17.png

../../_images/Wonder-Building-Kit-step-case-27-18.png

../../_images/Wonder-Building-Kit-step-case-27-19.png

../../_images/Wonder-Building-Kit-step-case-27-20.png

../../_images/Wonder-Building-Kit-step-case-27-21.png

../../_images/Wonder-Building-Kit-step-case-27-22.png

../../_images/Wonder-Building-Kit-step-case-27-23.png

../../_images/Wonder-Building-Kit-step-case-27-24.png

../../_images/Wonder-Building-Kit-step-case-27-25.png

../../_images/Wonder-Building-Kit-step-case-27-26.png

../../_images/Wonder-Building-Kit-step-case-27-27.png

../../_images/Wonder-Building-Kit-step-case-27-28.png

../../_images/Wonder-Building-Kit-step-case-27-29.png

../../_images/Wonder-Building-Kit-step-case-27-30.png

../../_images/Wonder-Building-Kit-step-case-27-31.png

29.5. Installation Mthods of Hardwares#

Install the sonar:bit with the bricks.

../../_images/Wonder-Building-Kit-step-sonar-bit-6.png

29.6. Hardware Connection#

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

../../_images/Wonder-Building-Kit-case-27-06.png

29.7. Software Platform#


MakeCode

29.8. Coding#


Add extensions#

Click “Advanced” in the MakeCode to see more choices.

../../_images/Wonder-Building-Kit-case-21-02.png

Search with Wukong in the dialogue box to download it.

../../_images/Wonder-Building-Kit-case-21-03.png

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

../../_images/Wonder-Building-Kit-case-27-04.png

Program#

../../_images/Wonder-Building-Kit-case-27-05.png

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.