TCS34725 (colour sensor) can't creat object.
Posted: Tue Feb 14, 2017 8:50 am
I'm using the Adafruit/tdicola TCS34725 micropython library https://github.com/adafruit/micropython ... cs34725.py and have had it working fine with my Pyboard.
But now (for some unknown reason) I am totally stuck; I can import the library but when I go to create the sensor objecti.e. "sensor = tcs34725.TCS34725(i2c)"
I get the following error message
>>> sensor = tcs34725.TCS34725(i2c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tcs34725.py", line 44, in __init__
File "tcs34725.py", line 90, in integration_time
File "tcs34725.py", line 54, in _register8
TypeError: can't convert bytes to int
The lines which throw the errors are:
self.integration_time(2.4)
self.i2c.mem_write(self.address, register, data)
return self._register8(_REGISTER_ATIME, 256 - cycles)
I'm very new to all this and have been fumbling around for days to try and find these bytes that cannot be converted to int with 0 success
Can anybody shed any light on this error or help me at all please?
EDIT: I've managed to create the object now by adjusting the library to work with pyb.I2C rather than machine.I2C. But now I just get a load of OSError: [Errno 5] EIO when I try to read the sensor.
But now (for some unknown reason) I am totally stuck; I can import the library but when I go to create the sensor objecti.e. "sensor = tcs34725.TCS34725(i2c)"
I get the following error message
>>> sensor = tcs34725.TCS34725(i2c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tcs34725.py", line 44, in __init__
File "tcs34725.py", line 90, in integration_time
File "tcs34725.py", line 54, in _register8
TypeError: can't convert bytes to int
The lines which throw the errors are:
self.integration_time(2.4)
self.i2c.mem_write(self.address, register, data)
return self._register8(_REGISTER_ATIME, 256 - cycles)
I'm very new to all this and have been fumbling around for days to try and find these bytes that cannot be converted to int with 0 success
Can anybody shed any light on this error or help me at all please?
EDIT: I've managed to create the object now by adjusting the library to work with pyb.I2C rather than machine.I2C. But now I just get a load of OSError: [Errno 5] EIO when I try to read the sensor.