Closed tripzero closed 9 years ago
Hrm are you sure this is an issue? I just tried out the current library code and get back 16-bit values from readVisible right now, for example shining a bright flashlight on the sensor is returning 1600+. If you look at the read16 function it grabs 2 bytes of data starting at the provided address: https://github.com/adafruit/Adafruit_SI1145_Library/blob/master/Adafruit_SI1145.cpp#L168-L169 This means it should be reading both the high and low order bytes for the visible, IR, etc. registers. and then packing them into a 16-bit response. I'll close this for now but let me know if there's something I missed.
If you are getting odd 65535 values then that sounds like there could be a communication issue between the chip and Arduino, like perhaps something else is on the I2C bus and pulling it to a high/low value that comes back as a bad reading. Double check the wiring, soldering connections, etc. Thanks!
Each visible register returns an 8 bit value according to the datasheet[1]. Trying to make an 8 bit number into a 16 bit number appears to result in a bad value (ie 65532). The same is true for readIr() but I don't address that issue in this patch.
[1] - Page 30: https://www.silabs.com/Support%20Documents/TechnicalDocs/Si1145-46-47.pdf