<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[DLight keeps giving max value]]></title><description><![CDATA[<p dir="auto">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:</p>
<pre><code>#include &lt;M5Atom.h&gt;
#include &lt;M5_DLight.h&gt;

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);
}
</code></pre>
<p dir="auto">This is the only output I get:</p>
<pre><code>Counter: 32
lux: 65535
Counter: 33
lux: 65535
Counter: 34
lux: 65535
Counter: 35
lux: 65535
Counter: 36
lux: 65535
Counter: 37
</code></pre>
<p dir="auto">Does anyone have an idea what I'm doing wrong?</p>
]]></description><link>https://community.m5stack.com/topic/7314/dlight-keeps-giving-max-value</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 14:54:13 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7314.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Feb 2025 15:52:39 GMT</pubDate><ttl>60</ttl></channel></rss>