Skip to content

Commit 16e61f1

Browse files
authored
Modified read speed
Reduced delay times from 250ms and 20ms to 1ms. This was done in accordance with the datasheet. E.G. no where does it say you need to wait 250ms or 20ms. It does say to set the line high for a minimum of 1ms (the second delay). This has been tested and is working in my of my projects
1 parent c978977 commit 16e61f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

DHT.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ boolean DHT::read(bool force) {
138138
// Go into high impedence state to let pull-up raise data line level and
139139
// start the reading process.
140140
digitalWrite(_pin, HIGH);
141-
delay(250);
141+
delay(1);
142142

143-
// First set data line low for 20 milliseconds.
143+
// First set data line low for 1 millisecond.
144144
pinMode(_pin, OUTPUT);
145145
digitalWrite(_pin, LOW);
146-
delay(20);
146+
delay(1);
147147

148148
uint32_t cycles[80];
149149
{

0 commit comments

Comments
 (0)