Beoordelingen
1 - 1 van 1 (1 pagina's)
Je winkelwagen is leeg!
I used micropython on a ESP32 to read this sensor.
(micropython.org and a nice IDE at thonny.org)
Connected ground and VCC (3V3, but it handles 5 Volt also)
added 10k pull ups on SCL and SDA and used it as a memory device.
Open I2C device in normal way, the default dev_id is 82 (not 164 as datasheet mentions, it assumes 8 bit, we use 7 bit shifted up)
The micropython call goes like this:
buffer=bytearray(2)
# read register at 0x00 realtime distance, 2 bytes
result = self.i2c.readfrom_mem_into(self.dev_id,0x00, buffer)
# unpack 2 bytes into 1 short integer using library function
distance = struct.unpack('>H',buffer)
print(distance) # in mm from lens