Open levietduc0712 opened 6 months ago
Your formula for calculating distance is incorrect. You need to use the bytes [6, 7, 12, 13, 18, 19, 24, 25, 30, 31, 36, 37] instead of [4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25]. You can check again in the datasheet.
So the final corrected code will be
for i in range(6): distance = (bytes_data[6 + (i*6) + 1] << 8) | (bytes_data[6 + (i*6)])
for i in range(6):
distance = (bytes_data[6 + (i*6) + 1] << 8) | (bytes_data[6 + (i*6)])
Your formula for calculating distance is incorrect. You need to use the bytes [6, 7, 12, 13, 18, 19, 24, 25, 30, 31, 36, 37] instead of [4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25]. You can check again in the datasheet.