Raspberry Pi Pico practice problem · Raspberry Pi Pico
Obstacle stop
MediumBudget $31MicroPython
An obstacle-avoidance sensor has its OUT on GP16; VCC is on 3V3, GND is on GND. The comparator output is HIGH when an object is within 20 cm. A DC motor on the L298N is wired IN1 GP20, IN2 GP21, ENA GP22.
Stop the motor while the path is blocked; drive forward when it is clear. The test starts with an object 10 cm away and clears the path at 1.3 s.