Zum Inhalt springen

Projekte

#24 Money Box Project With micro:bit

von PicoBricks Team 16 Jun 2025

PicoBricks Money Box can detect objects placed in its receptacle through distance sensor in the front of it and automatically lifts its receptacle to take in these objects.

In this project, when the distance sensor detects the object placed in the receptacle , the servo motor connected to the motor driver is adjusted to the angle specified in the code, and then the object inside the receptacle is dropped into the Money Box.

Connection Diagram:

You can assemble this project by breaking apart the PicoBricks modules at the proper points.

Project Images:


Setup Steps of The Project


MakeCode Code of The Project


Python Code of The Project:


#Money Box Project
from microbit import *
from picobricks import *

# Function Initialization
motor = motordriver()
motor.servo(1,180)

trashDetected=0
distance=100

while True:
    rawdistance=measure_distance()
    if rawdistance<1200:
        distance=rawdistance
    motor.servo(1,180)
    sleep(500)
    if distance<5:
        trashDetected=1
        sleep(300)
    if distance>9 and trashDetected==1:
        trashDetected=0
        motor.servo(1,90)
        sleep(500)

MicroBlocks Code of The Project

Vorheriger Beitrag
Nächster Beitrag

Danke fürs Abonnieren!

Diese E-Mail wurde registriert!

Shoppen Sie den Look
Wählen Sie Optionen

Picobricks
Melden Sie sich für exklusive Updates an, Neuankömmlinge und Insider-Rabatte

Bearbeitungsoption

Benachrichtigung wieder auf Lager

Vergleichen

Produkt ArtikelnummerBewertungBeschreibung Sammlung Verfügbarkeit Produktart Andere Details
this is just a warning
Anmeldung
Einkaufswagen
0 Artikel
Same Day Shipping No Extra Costs
Easy Returns Guarantee Return with Ease
Secure Checkout Secure Payment