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: 37Does anyone have an idea what I'm doing wrong?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login