Changed return value of getEvent

value of 0 could be a valid value in darkness, better to return a value > 65535 to report saturation and return false from getEvent in that case!
This commit is contained in:
Bernd Giesecke
2016-01-10 00:05:59 +08:00
parent bcb5729944
commit 4f542c8d0b

View File

@ -9,7 +9,7 @@ tsl.setGain(TSL2561_GAIN_16X); /* 16x gain ... use in low light to boost sen
tsl.enableAutoGain(true); /* Auto-gain ... switches automatically between 1x and 16x */ tsl.enableAutoGain(true); /* Auto-gain ... switches automatically between 1x and 16x */
``` ```
The driver also supports as automatic clipping detection, and will return '0' lux when the sensor is saturated and data is unreliable. The driver also supports as automatic clipping detection, and will return '65536' lux when the sensor is saturated and data is unreliable. tsl.getEvent will return false in case of saturation and true in case of valid light data.
## About the TSL2561 ## ## About the TSL2561 ##
@ -44,4 +44,4 @@ Light sensors will always report units in lux, gyroscopes will always report uni
Adafruit invests time and resources providing this open source code. Please support Adafruit and open-source hardware by purchasing products from Adafruit! Adafruit invests time and resources providing this open source code. Please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Kevin (KTOWN) Townsend for Adafruit Industries. Written by Kevin (KTOWN) Townsend for Adafruit Industries.