From b07db5af21d60cf9eba3541fe3d52201d01d384f Mon Sep 17 00:00:00 2001 From: Michel Metzger Date: Thu, 2 Nov 2017 22:53:50 -0400 Subject: [PATCH] Fix for slower boards. Use uint16_t in expectPulse loop to increase sampling rate and avoid bad readings. Tested on atmega328 @ 8MHz and Feather M0 @ 48MHz --- DHT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DHT.cpp b/DHT.cpp index 86ad91c..618c8fe 100644 --- a/DHT.cpp +++ b/DHT.cpp @@ -235,7 +235,7 @@ boolean DHT::read(bool force) { // in the very latest IDE versions): // https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_pulse.c uint32_t DHT::expectPulse(bool level) { - uint32_t count = 0; + uint16_t count = 0; // On AVR platforms use direct GPIO port access as it's much faster and better // for catching pulses that are 10's of microseconds in length: #ifdef __AVR