I have a Raspberry Pi ZW running Stretch 9.6, Python versions 2.7.13 (default) and 3.5.3.
I have been running a python script that returned the range to target but this has stopped working. I have changed nothing in the set up.
When I run the script I get the following error
Traceback (most recent call last):
File “_ctypes/callbacks.c”, line 315, in ‘calling callback function’
File “/usr/local/lib/python2.7/dist-packages/VL53L1X.py”, line 117, in _i2c_write
self._i2c.i2c_rdwr(msg_w)
File “/usr/local/lib/python2.7/dist-packages/smbus2/smbus2.py”, line 497, in i2c_rdwr
ioctl(self.fd, I2C_RDWR, ioctl_data)
IOError: [Errno 121] Remote I/O error
This is the code.
#!/usr/bin/env python
import os
import time
import sys
import signal
import VL53L1X
#print(""“distance.py
#Display the distance read from the sensor.
#One ping.one ping only Vasilly.
#”"")
“”"
Open and start the VL53L1X ranging sensor
“”"
tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29)
tof.open() # Initialise the i2c bus and configure the sensor
tof.start_ranging(1) # Start ranging, 1 = Short Range, 2 = Medium Range, 3 = Long Range
#time.sleep(0.1) #pause for 10th second
count = 0
while (count <4):
distance_in_mm = tof.get_distance() # Grab the range in mm
#print(“Distance: {}mm”.format(distance_in_mm))
#time.sleep(0.1) #pause for 10th second
count = count + 1
msg = distance_in_mm
print(msg)
sys.exit()