PyRasp

← All practice problems

Raspberry Pi Pico practice problem · Raspberry Pi Pico

Distance alarm

MediumBudget $10MicroPython

Use the same safe HC-SR04 wiring as Print the distance: TRIG GP20, ECHO GP21 through the 1 kΩ + 2 kΩ divider. Add a piezo active buzzer on GP13.

Beep while the object is closer than 30 cm, and stay silent otherwise. The test starts at 100 cm and moves the object to 15 cm at 1.2 s.

More in Raspberry Pi Pico