python-apds9960
python-apds9960 copied to clipboard
not working esp32
exec(open('test_ambient.py').read(),globals())
Traceback (most recent call last):
File "
exec(open('test_ambient.py').read(),globals()) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 10, in <module> File "apds9960/device.py", line 41, in __init__ File "apds9960/exceptions.py", line 3, in __init__ AttributeError: type object 'Exception' has no attribute '__init__'
There seems to be a problem to get an instance of the ADPS9960InvalidDevId
class. The I2C device ID of your APDS9960 is missing in https://github.com/liske/python-apds9960/blob/938fab1a96bddd40bb258a767984c25cfea5e3a6/apds9960/const.py#L9-L10
It should work if you put the device ID into the well-known list (and your APDS9960 is compatible). Feel free to open a merge request after you have verified the device ID.
hi everyone, this is the problem with I2C parameters replace the code with bus = I2C(-1, scl = Pin(22), sda = Pin(21)) this will work.
apds.setProximityIntLowThreshold(0) apds.setProximityIntHighThreshold(200) apds.setGestureEnterThresh(0) apds.setGestureExitThresh(200) apds.setGestureLEDDrive(APDS9960_LED_DRIVE_50MA) apds.setGestureGain(APDS9960_GGAIN_2X) apds.enableGestureSensor()