mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Merge pull request #115 from owenduffy/master
Fix timing and pin mode change to comply with datasheet.
This commit is contained in:
commit
b3b0b08d6d
5
DHT.cpp
5
DHT.cpp
@ -162,11 +162,10 @@ bool DHT::read(bool force) {
|
|||||||
|
|
||||||
// End the start signal by setting data line high for 40 microseconds.
|
// End the start signal by setting data line high for 40 microseconds.
|
||||||
digitalWrite(_pin, HIGH);
|
digitalWrite(_pin, HIGH);
|
||||||
delayMicroseconds(40);
|
pinMode(_pin, INPUT_PULLUP);
|
||||||
|
|
||||||
// Now start reading the data line to get the value from the DHT sensor.
|
// Now start reading the data line to get the value from the DHT sensor.
|
||||||
pinMode(_pin, INPUT_PULLUP);
|
delayMicroseconds(60); // Delay a bit to let sensor pull data line low.
|
||||||
delayMicroseconds(10); // Delay a bit to let sensor pull data line low.
|
|
||||||
|
|
||||||
// First expect a low signal for ~80 microseconds followed by a high signal
|
// First expect a low signal for ~80 microseconds followed by a high signal
|
||||||
// for ~80 microseconds again.
|
// for ~80 microseconds again.
|
||||||
|
Loading…
Reference in New Issue
Block a user