Browse Source

sensor/dht: set pin mode before digitalWrite

master
Maxim Prokhorov 5 years ago
committed by Max Prokhorov
parent
commit
e1ed62af37
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      code/espurna/sensors/DHTSensor.h

+ 2
- 1
code/espurna/sensors/DHTSensor.h View File

@ -137,13 +137,14 @@ class DHTSensor : public BaseSensor {
unsigned char byteInx = 0;
unsigned char bitInx = 7;
pinMode(_gpio, OUTPUT);
// Send start signal to DHT sensor
if (++_errors > DHT_MAX_ERRORS) {
_errors = 0;
digitalWrite(_gpio, HIGH);
nice_delay(250);
}
pinMode(_gpio, OUTPUT);
noInterrupts();
digitalWrite(_gpio, LOW);
if ((_type == DHT_CHIP_DHT11) || (_type == DHT_CHIP_DHT12)) {


Loading…
Cancel
Save