Ultrasonic Ranger Problems

hello, I am trying to use the Grove Ultrasonic Ranger (v2.0), with the GrovePi+ hat on a raspberrypi 3b+. The device is detected when using ‘sudo i2cdetect -y 1’, but, when I run the program, nothing happens. I do not get an error, nor does anything print. It is as if the program is running, but stuck, and not giving an error. I am using the default code provided. I have used different ports, and am getting the same thing. Even when I run the program without changing the port that it is connected to, nothing happens. Below is the code I am using, which is the code given on seeedstudio.

GrovePi + Grove Ultrasonic Ranger

from grovepi import *

Connect the Grove Ultrasonic Ranger to digital port D4

SIG,NC,VCC,GND

ultrasonic_ranger = 4

while True:
try:
# Read distance value from Ultrasonic
print ultrasonicRead(ultrasonic_ranger)

except TypeError:
    print "Error"
except IOError:
    print "Error"
1 Like

Well. . . .

The first thing I would try is making the error messages more specific so you know what kind of error you are experiencing.