DLight keeps giving max value
-
I have a brand new DLight. I used the M5Stack example code but all I get is the max value of the sensor, even when I cover the sensor. I tried all 6 modes. I also searched the internet but couldn't find any solution. I added a counter to the example. Here is my code:
#include <M5Atom.h> #include <M5_DLight.h> M5_DLight sensor; uint16_t lux; uint16_t counter = 0; void setup() { M5.begin(true, true, true); Serial.println("Sensor begin....."); sensor.begin(); // CONTINUOUSLY_H_RESOLUTION_MODE // CONTINUOUSLY_H_RESOLUTION_MODE2 // CONTINUOUSLY_L_RESOLUTION_MODE // ONE_TIME_H_RESOLUTION_MODE // ONE_TIME_H_RESOLUTION_MODE2 // ONE_TIME_L_RESOLUTION_MODE sensor.setMode(CONTINUOUSLY_H_RESOLUTION_MODE); } void loop() { M5.dis.fillpix(0x00ff00); lux = sensor.getLUX(); Serial.printf("lux: %d\n", lux); counter = counter + 1; Serial.printf("Counter: %d\n", counter); delay(200); }
This is the only output I get:
Counter: 32 lux: 65535 Counter: 33 lux: 65535 Counter: 34 lux: 65535 Counter: 35 lux: 65535 Counter: 36 lux: 65535 Counter: 37
Does anyone have an idea what I'm doing wrong?