Post
by GDorn » Mon Jan 15, 2018 7:44 pm
I'm trying to update this code to work with the new 'machine' paradigm, but running into a problem.
[CODE]
>>> import machine
>>> i2c = machine.I2C(scl=machine.Pin(14), sda=machine.Pin(12))
>>> i2c.scan()
[64]
>>> i2c.readfrom_mem(64, 227, 3) # 227 = TRIGGER_TEMP_MEASURE_HOLD
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 110] ETIMEDOUT
>>>
[/CODE]
The error changes on each read, though; sometimes it is ETIMEDOUT, sometimes ENODEV, and incredibly rarely it returns b'\x00\x00\x00'.
I'm pretty sure my wiring is correct, as i2c.scan() does return the right address (the device is locked to 0x40, which is 64), but attempts to read from it fail.
I'm pretty new to i2c and micropython, so maybe I'm using the wrong function to read from the device?