Skip to content

Commit b3b0b08

Browse files
Merge pull request #115 from owenduffy/master
Fix timing and pin mode change to comply with datasheet.
2 parents be8859e + b429942 commit b3b0b08

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

DHT.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,10 @@ bool DHT::read(bool force) {
162162

163163
// End the start signal by setting data line high for 40 microseconds.
164164
digitalWrite(_pin, HIGH);
165-
delayMicroseconds(40);
165+
pinMode(_pin, INPUT_PULLUP);
166166

167167
// Now start reading the data line to get the value from the DHT sensor.
168-
pinMode(_pin, INPUT_PULLUP);
169-
delayMicroseconds(10); // Delay a bit to let sensor pull data line low.
168+
delayMicroseconds(60); // Delay a bit to let sensor pull data line low.
170169

171170
// First expect a low signal for ~80 microseconds followed by a high signal
172171
// for ~80 microseconds again.

0 commit comments

Comments
 (0)