liske / python-apds9960

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

APDS9960InvalidDevID #13

Closed yoyojacky closed 4 weeks ago

yoyojacky commented 2 years ago

I am using Raspberry Pi 4B, python3.7 I've got this error message:

pi@rpi4g:~/apds9960 $ i2cget -y 1 0x39 0x92
0x39
pi@rpi4g:~/apds9960 $ vim test_ambient.py
pi@rpi4g:~/apds9960 $ python3 test_ambient.py
Traceback (most recent call last):
  File "test_ambient.py", line 11, in <module>
    apds = APDS9960(bus)
  File "/home/pi/.local/lib/python3.7/site-packages/apds9960/device.py", line 41, in __init__
    raise ADPS9960InvalidDevId(self.dev_id, valid_id)
apds9960.exceptions.ADPS9960InvalidDevId: Device id 0x39 is not a valied one (valid: 0xab, 0x9c, 0xa8)!

when i using i2cget -y 1 0x39 0x92, i got 0x39 but is not include in

# APDS9960 device IDs
APDS9960_DEV_ID = [0xab, 0x9c, 0xa8, -0x55]

How to solve this problem Please?

aquananu commented 3 months ago

hi i hv a clone GY9960 and it has address 0xA8 and lib works after modifying line 10 of const.py as below

APDS9960 device IDs

APDS9960_DEV_ID = [0xab, 0x9c, 0xa8, -0x55, 0xA8]

please make changes and merge

aquananu commented 3 months ago

I am using Raspberry Pi 4B, python3.7 I've got this error message:

pi@rpi4g:~/apds9960 $ i2cget -y 1 0x39 0x92
0x39
pi@rpi4g:~/apds9960 $ vim test_ambient.py
pi@rpi4g:~/apds9960 $ python3 test_ambient.py
Traceback (most recent call last):
  File "test_ambient.py", line 11, in <module>
    apds = APDS9960(bus)
  File "/home/pi/.local/lib/python3.7/site-packages/apds9960/device.py", line 41, in __init__
    raise ADPS9960InvalidDevId(self.dev_id, valid_id)
apds9960.exceptions.ADPS9960InvalidDevId: Device id 0x39 is not a valied one (valid: 0xab, 0x9c, 0xa8)!

when i using i2cget -y 1 0x39 0x92, i got 0x39 but is not include in

# APDS9960 device IDs
APDS9960_DEV_ID = [0xab, 0x9c, 0xa8, -0x55]

How to solve this problem Please?

Hello, the address u r referring is i2c address and device works with that address, the problem is that the device id might not be included in the const.py - please see if your module isnt a clone.

yoyojacky commented 3 months ago

I am using Raspberry Pi 4B, python3.7 I've got this error message:

pi@rpi4g:~/apds9960 $ i2cget -y 1 0x39 0x92
0x39
pi@rpi4g:~/apds9960 $ vim test_ambient.py
pi@rpi4g:~/apds9960 $ python3 test_ambient.py
Traceback (most recent call last):
  File "test_ambient.py", line 11, in <module>
    apds = APDS9960(bus)
  File "/home/pi/.local/lib/python3.7/site-packages/apds9960/device.py", line 41, in __init__
    raise ADPS9960InvalidDevId(self.dev_id, valid_id)
apds9960.exceptions.ADPS9960InvalidDevId: Device id 0x39 is not a valied one (valid: 0xab, 0x9c, 0xa8)!

when i using i2cget -y 1 0x39 0x92, i got 0x39 but is not include in

# APDS9960 device IDs
APDS9960_DEV_ID = [0xab, 0x9c, 0xa8, -0x55]

How to solve this problem Please?

Hello, the address u r referring is i2c address and device works with that address, the problem is that the device id might not be included in the const.py - please see if your module isnt a clone.

thanks for your tips, it seems like that the module is broken by accident, I have changed another one.