GrovePi + Ultrasonic sensor

I have the GrovePi board on a Raspberry pi 3B using the OS:

Then I type sudo i2cdetect -y 1, I get the expected 04 being shown.

With the US Sensor on Port 4 (with power off) and running your python programme I get:
a Error message saying “Type Error” ( I modified the to show which error was taking place.
The original just typed error.)

After the when I retry the I2cdetect -y 1 the 04 has disappeared.

I thought that grove would be simple to work with, so I am a bit disappointed.

I have other sensors I need to try out and need to buy more.

Please assist!!

Your Python programme:

import grovepi

Connect the Grove Ultrasonic Ranger to digital port D4


ultrasonic_ranger = 4

while True:
# Read distance value from Ultrasonic

except TypeError:
    print ("Type-Error")
except IOError:
 print ("IOError-Error")

There is an update to the ultrasonic_sensor example here:

specifically these lines have been added:

# set I2C to use the hardware bus