adafruit / Adafruit_TSL2591_Library

This is an Arduino library for the TSL2591 digital luminosity (light) sensors.
58 stars 48 forks source link

180uLux to 88000 Lux #4

Closed peekpt closed 8 years ago

peekpt commented 9 years ago

Dear dev, How I'm supposed to read more than 65535 value from a uint16_t type? All functions returns 16 bit values!

tdicola commented 8 years ago

Check the calculateLux function, it returns a uint32_t value. In the datasheet you can see the device actually just has a 16-bit ADC so all of the data from it is at most 16-bit values, however you can also adjust the gain to read such a wide range of values from just a 16-bit ADC. The calculateLux function takes into account the current gain setting (and other state like integration time) to calculate a 32-bit lux value.