Skip to content

Commit b429942

Browse files
committed
Fix timing and pin mode change to comply with datasheet.
1 parent c978977 commit b429942

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
@@ -153,11 +153,10 @@ boolean DHT::read(bool force) {
153153

154154
// End the start signal by setting data line high for 40 microseconds.
155155
digitalWrite(_pin, HIGH);
156-
delayMicroseconds(40);
156+
pinMode(_pin, INPUT_PULLUP);
157157

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

162161
// First expect a low signal for ~80 microseconds followed by a high signal
163162
// for ~80 microseconds again.

0 commit comments

Comments
 (0)