From 6c360d947384fa71d378230305e5225cbcf3c033 Mon Sep 17 00:00:00 2001 From: admar Date: Wed, 25 May 2022 23:33:57 +0200 Subject: [PATCH] Use 256 x oversampling to reduce noise on light sensor --- Claire.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Claire.ino b/Claire.ino index 73f1846..949674f 100644 --- a/Claire.ino +++ b/Claire.ino @@ -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 {