Datasheet
This function will return a reading in SI lux units, which is probably the easiest unit to understand
when working with light.
If you wish to manually read the individual photo diodes, though, you can still do this in the latest
library by calling the getLuminosity function, and passing in two variables where the sensor data
will be stored:
That's it! The example should be easy to understand and work into your own projects from here!
/* Get a new sensor event */
sensors_event_t event;
tsl.getEvent(&event);
/* Display the results (light is measured in lux) */
if (event.light)
{
Serial.print(event.light); Serial.println(" lux");
}
else
{
/* If event.light = 0 lux the sensor is probably saturated
and no reliable data could be generated! */
Serial.println("Sensor overload");
}
uint16_t broadband = 0;
uint16_t infrared = 0;
/* Populate broadband and infrared with the latest values */
getLuminosity (&broadband, &infrared);
© Adafruit Industries https://learn.adafruit.com/tsl2561 Page 12 of 14