Adafruit_TSL2561 icon indicating copy to clipboard operation
Adafruit_TSL2561 copied to clipboard

Questions about this new library version

Open esp13 opened this issue 5 years ago • 0 comments

Hi,

I'm updating my TSL2561 library on arduino IDE and notice the many changes and have some questions:

(1) - Is it still possible to get Channel 0 and channel 1 (Full light and IR light) datas instead of getting only the result (global Lux)? If yes, how to do that? -Edit- I tried to adapt the example like this:

void loop(void) 
{  
   uint16_t broadband, infrared;
  /* 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.print(" lux\t");
    tsl.getLuminosity(&broadband, &infrared);
    Serial.print(broadband); Serial.print(" full\t");
    Serial.print(infrared); Serial.println(" Ir");
  }
  else
  {
    /* If event.light = 0 lux the sensor is probably saturated
       and no reliable data could be generated! */
    Serial.println("Sensor overload");
  }
  delay(250);
  
}

Is It a right way? I'm not familiar with this event call. Will getluminosity() results corresponding to the event time? Or will it return before/after measurements?

(2) - How is the events part working? when I set the sensor integration time to 402ms, the event shouldn't comes before at least 402ms, but the results are coming right after the tsl.getEvent(&event); call

(3) - The disable() function that powering off the sensor is call without waiting the sensor event ? (PS: In cpp enable() / disable() functions shouldn't be after "private" comment ? ) -Edit- OKay, there is a delay in getData function. So isn't it a "real" event work? (with timeout for example?)

(4) - Why is the I2C address set at declaration of the object and not at the begin() call like many other sensors library's? I would like to do some multiple sensors detection by scanning I2C bus and then begin each of them with their own address. But if the declaration already set the address I can't set it in the setup() section.

PS : Sorry for my poor English level.

esp13 avatar Sep 09 '19 07:09 esp13