I am trying to use the grove ultrasonic ranger on the raspberry pi with the grovepi+ hat. I have followed the instructions exactly to set it up, but when I run the default program (or a personal program that performs basically the same task), nothing happens. In the terminal, it is just blank, I do not receive an error or any text. I am thinking it is the ultrasonicRead() function itself, getting stuck in a loop somewhere inside. Any help with this?
1 Like
Hi @salman, I am using the code from this link, https://wiki.seeedstudio.com/Grove-Ultrasonic_Ranger/ . I have also followed all of the setup instructions, as different grove modules are working properly. Also, when I run i2cdetect -y 1, the ranger is detected.
1 Like
# 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"
Here is the exact code.
Can you try connecting different port and try agin!
I just tried different ports, and the same issue happens. However, I would run the code without changing ultrasonic_ranger = 4, and the same thing would happen. I tried changing this to ultrasonic_ranger = 3, 2, etc, and nothing happened.
1 Like
Hello!
The ultrasonic ranger is working now, a complete re-installation helped.
Hope this helps.