liske / python-apds9960

Python APDS-9960 Library
GNU General Public License v3.0
78 stars 27 forks source link

not working esp32 #10

Open coffice12 opened 5 years ago

coffice12 commented 5 years ago

exec(open('test_ambient.py').read(),globals()) Traceback (most recent call last): File "", line 1, in File "", line 10, in File "apds9960/device.py", line 41, in init File "apds9960/exceptions.py", line 3, in init AttributeError: type object 'Exception' has no attribute 'init'

coffice12 commented 5 years ago

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__'

liske commented 5 years ago

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.

nikhilabhi commented 4 years ago

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.

lijutsang commented 2 years ago

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()