Adafruit_APDS9960
Adafruit_APDS9960 copied to clipboard
I have problems with RGB reader value and with de calculate LUX and Color temperature.
Hi Guys. I am working whit an APDS-9960, I am try obtain the LUX and Color temperature with Adafruit library, but the result that I obtein is not real. If I read with a luxmeter the result is very diferent, Do you have any Examples with tested code?
My test code is: #include "Adafruit_APDS9960.h" Adafruit_APDS9960 apds;
void setup() { Serial.begin(115200);
if(!apds.begin()){ Serial.println("failed to initialize device! Please check your wiring."); } else Serial.println("Device initialized!"); //enable color sensign mode apds.enableColor(true); }
void loop() { //create some variables to store the color data in uint16_t r, g, b, c; //wait for color data to be ready while(!apds.colorDataReady()){ delay(5); } //get the data and print the different channels apds.getColorData(&r, &g, &b, &c); Serial.print("red: "); Serial.print(r); Serial.print(" green: "); Serial.print(g); Serial.print(" blue: "); Serial.print(b); Serial.print(" clear: "); Serial.println(c); Serial.println(); float luz=apds.calculateLux(r,g,b); float color=apds.calculateColorTemperature(r,g,b); Serial.print (" LUXES: "); Serial.println (luz); Serial.print (" Color: "); Serial.println (color); delay(500); } Regards. Seba