Grove Pi Problem


Hi, I have a problem with the Raspberry Pi 3 and the Grove Pi, I had seen some code on the website but I doesn’t seem to work even if I change the port of the Ultrasonic Sensor. Below there is a picture of the setup as well as the full code.

Project Non (2.8 KB)


Hi @zejza69,

The function for the ultrasonic sensor takes one argument.
That argument represents the pin number to which the sensor is plugged in.
I have also tested it and it works (w/o the picamera attached as I don’t have one around).

You should have something like this:

ultrasonic_pin = 0 # based on the sensor's location in your photo

while True:
    if grovepi.ultrasonicRead(ultrasonic_pin) < 100: # here we go
        print("Object detected")

Some code seems impossible to debug, and you end up hitting your head against the table looking for the issue, only to come back a little later and find a miss-spelling or other detail.

Other than that, I see you want to create a surveillance system.
It seems like a really fun project. Maybe you can keep us updated with your work.

Thank you!