See also my sample code:
Have a look at the print or println statements in your arduino sketch.
As long as you are using the sample code you will not have success.
Check were the data for the LUX value is coming from. See the Adafruits sample code for the detector (see: Adafruit TSL 2591 Library )
void advancedRead(void)
{
// More advanced data read example. Read 32 bits with top 16 bits IR, bottom 16 bits full spectrum
// That way you can do whatever math and comparisons you want!
uint32_t lum = tsl.getFullLuminosity();
uint16_t ir, full;
ir = lum >> 16;
full = lum & 0xFFFF;
Serial.print(F("[ ")); Serial.print(millis()); Serial.print(F(" ms ] "));
Serial.print(F("IR: ")); Serial.print(ir); Serial.print(F(" "));
Serial.print(F("Full: ")); Serial.print(full); Serial.print(F(" "));
Serial.print(F("Visible: ")); Serial.print(full - ir); Serial.print(F(" "));
Serial.print(F("Lux: ")); Serial.println(tsl.calculateLux(full, ir), 6);
}
and modify it accordingly:
void advancedRead(void)
{
// More advanced data read example. Read 32 bits with top 16 bits IR, bottom 16 bits full spectrum
// That way you can do whatever math and comparisons you want!
uint32_t lum = tsl.getFullLuminosity();
uint16_t ir, full;
ir = lum >> 16;
full = lum & 0xFFFF;
Serial.print(millis());
Serial.print(",");
Serial.print(ir);
Serial.print(",");
Serial.print(full);
Serial.print(",");
Serial.print(full - ir);
Serial.print((",");
Serial.println(tsl.calculateLux(full, ir), 6);
}
Not tested, but you now get a csv seperated line and next step is to learn how to read the data in Processing.
And for the calculated LUX value just:
void advancedRead(void)
{
// More advanced data read example. Read 32 bits with top 16 bits IR, bottom 16 bits full spectrum
// That way you can do whatever math and comparisons you want!
uint32_t lum = tsl.getFullLuminosity();
uint16_t ir, full;
ir = lum >> 16;
full = lum & 0xFFFF;
Serial.println(tsl.calculateLux(full, ir), 6);
}
And your code should look like:
if ((event.light > 500))
{
luxCheck = 1;
Serial.println(tsl.calculateLux(full, ir), 2);
}