Corrected 10bit ADC read for 8266

pull/2737/head
Blaž Kristan 2021-05-21 12:40:38 +02:00
rodzic 0ada09891c
commit c4086b9127
1 zmienionych plików z 2 dodań i 3 usunięć

Wyświetl plik

@ -72,11 +72,10 @@ void handleAnalog(uint8_t b)
{ {
static uint8_t oldRead[WLED_MAX_BUTTONS]; static uint8_t oldRead[WLED_MAX_BUTTONS];
#ifdef ESP8266 #ifdef ESP8266
#define ANALOGPIN A0 uint8_t aRead = analogRead(A0) >> 2; // convert 10bit read to 8bit
#else #else
#define ANALOGPIN btnPin[b] uint8_t aRead = analogRead(btnPin[b]) >> 4; // convert 12bit read to 8bit
#endif #endif
uint8_t aRead = analogRead(ANALOGPIN) >> 4; // convert 12bit read to 8bit
if (oldRead[b] == aRead) return; // no change in reading if (oldRead[b] == aRead) return; // no change in reading