Skip to content

Commit 70eeace

Browse files
authored
Update MKRENV.cpp
fixed lux scaling. 1uA = 2 lux. since we have a 10K resistor 1 lux will produce 5mV. note that the ADC will saturate at around 650 lux, which is then the max illuminance we can detect
1 parent e24584c commit 70eeace

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MKRENV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ float ENVClass::readIlluminance(int units)
179179
// read analog value and convert to mV
180180
float mV = (analogRead(_lightSensorPin) * 3300.0) / 1023.0;
181181

182-
// 2 mV per lux
183-
float reading = (mV / 2.0); // Readings are in Lux scale
182+
// 5 mV per lux
183+
float reading = (mV / 5.0); // Readings are in Lux scale
184184
if (units == FOOTCANDLE) { // 1 Lux = 0.092903 Foot-Candle
185185
return reading * 0.092903;
186186
} else {

0 commit comments

Comments
 (0)