Skip to content

Commit b07db5a

Browse files
committed
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
1 parent c978977 commit b07db5a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

DHT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ boolean DHT::read(bool force) {
235235
// in the very latest IDE versions):
236236
// https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_pulse.c
237237
uint32_t DHT::expectPulse(bool level) {
238-
uint32_t count = 0;
238+
uint16_t count = 0;
239239
// On AVR platforms use direct GPIO port access as it's much faster and better
240240
// for catching pulses that are 10's of microseconds in length:
241241
#ifdef __AVR

0 commit comments

Comments
 (0)