import smbus import time address = 0x57 sensor = smbus.SMBus(1) while True: sensor.write_byte(address, 0x01) time.sleep(0.2) bytes = sensor.read_i2c_block_data(address, 0, 3) distance = ((bytes[0] << 16) + (bytes[1] << 8) + bytes[2]) / 10000 print(distance)