You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi folks!
I have a strange problem with one of my I2C devices.
If I use the traditional try_lock() function, I get correct communication with my I2C device, If I use the improved I2CDevice, the communication stops.
This is the sample code I wrote to check my sanity:
import busio
import board
import time
#this works
i2c = busio.I2C(board.SCL, board.SDA)
while not i2c.try_lock():
pass
try:
i2c.writeto(0x0f, bytearray([0x84,0x02,0x01]))
print("done one")
finally:
i2c.unlock()
#this does not work....
from adafruit_bus_device.i2c_device import I2CDevice
device = I2CDevice(i2c, 0x0f)
with device:
device.write(bytearray([0x84,0x02,0x01]))
print("done two")
This is what I see on the logic analyser:
It seems to be specific to the I2C device, it is a grove i2c motor driver
I tried the same with a temperature sensor but that worked fine..
The text was updated successfully, but these errors were encountered:
Hi folks!
I have a strange problem with one of my I2C devices.
If I use the traditional try_lock() function, I get correct communication with my I2C device, If I use the improved I2CDevice, the communication stops.
This is the sample code I wrote to check my sanity:
This is what I see on the logic analyser:

It seems to be specific to the I2C device, it is a grove i2c motor driver
I tried the same with a temperature sensor but that worked fine..
The text was updated successfully, but these errors were encountered: