Use 256 x oversampling to reduce noise on light sensor

This commit is contained in:
Admar Schoonen 2022-05-25 23:33:57 +02:00
parent e413703196
commit 6c360d9473
1 changed files with 5 additions and 1 deletions

View File

@ -335,7 +335,11 @@ void readSensors(void) {
output += " ppm, eVOC: " + String(iaqSensor.breathVocEquivalent);
output += " ppm";
int light = analogRead(LIGHT_PIN);
int light = 0;
for (int n = 0; n < 256; n++) {
light += analogRead(LIGHT_PIN);
}
light = (light + 128) >> 8;
output += ", light: " + String(light);
Serial.println(output);
} else {