I am trying to connect the Ranger Ultrasonic sensor directly to a Raspberry Pi4. My hardware connections are; 3.3v pin, gnd pin and gpio pin 5. I have checked the voltage and pin status, and all are good. I ran the following code;
from grove.grove_ultrasonic_ranger import GroveUltrasonicRanger
sensor = GroveUltrasonicRanger(5)
distance = sensor.get_distance()
Nothing happens, except 1 time I did get readings when nothing was in front of the sensor. All other times no results or errors.
I insured that GPIO 5 is input.
I did get some strange results(which I think you will find hard to believe).
If I execute the script nothing happens but if I disconnect the 3.3v supply while it is running I get some output (nothing in front of sensor).