Ultrasonic sensor HC-SR04 on raspberry pi pico

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
yuanyanhui
Posts: 12
Joined: Wed Mar 20, 2019 11:25 am

Ultrasonic sensor HC-SR04 on raspberry pi pico

Post by yuanyanhui » Thu Jul 01, 2021 7:10 am

It doesn't work using GP6 and GP7 as trig and echo at the same time . Works for GP8 and GP9 and other pins. I used the following library.
https://github.com/rsc1975/micropython-hcsr04

yuanyanhui
Posts: 12
Joined: Wed Mar 20, 2019 11:25 am

Re: Ultrasonic sensor HC-SR04 on raspberry pi pico

Post by yuanyanhui » Thu Jul 01, 2021 1:44 pm

The problem seems to be that GP6 cannot be configured as trig. Using other pins as trig, the sensor works properly. The sensor also works fine with GP6 as echo. In the library code, GP6 is used as simple output. Strange thing is GP6 can be used as output to blink an led. I am confused...

Post Reply