From c4086b91277188e955a142018b3517933ae5274c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Fri, 21 May 2021 12:40:38 +0200 Subject: [PATCH] Corrected 10bit ADC read for 8266 --- wled00/button.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wled00/button.cpp b/wled00/button.cpp index 80402b86..ced01781 100644 --- a/wled00/button.cpp +++ b/wled00/button.cpp @@ -72,11 +72,10 @@ void handleAnalog(uint8_t b) { static uint8_t oldRead[WLED_MAX_BUTTONS]; #ifdef ESP8266 - #define ANALOGPIN A0 + uint8_t aRead = analogRead(A0) >> 2; // convert 10bit read to 8bit #else - #define ANALOGPIN btnPin[b] + uint8_t aRead = analogRead(btnPin[b]) >> 4; // convert 12bit read to 8bit #endif - uint8_t aRead = analogRead(ANALOGPIN) >> 4; // convert 12bit read to 8bit if (oldRead[b] == aRead) return; // no change in reading