From b9e158efe43dbb245e42b32cacf7d959271a9ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 3 Jan 2018 11:19:44 +0100 Subject: [PATCH] Using delay instead of delayMicroseconds on DHT warmup delay --- code/espurna/sensors/DHTSensor.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/espurna/sensors/DHTSensor.h b/code/espurna/sensors/DHTSensor.h index ba4e48b0..101e35e6 100644 --- a/code/espurna/sensors/DHTSensor.h +++ b/code/espurna/sensors/DHTSensor.h @@ -137,7 +137,11 @@ class DHTSensor : public BaseSensor { pinMode(_gpio, OUTPUT); noInterrupts(); digitalWrite(_gpio, LOW); - delayMicroseconds(_type == DHT_CHIP_DHT11 ? 20000 : 500); + if (_type == DHT_CHIP_DHT11) { + delay(20); + } else { + delayMicroseconds(500); + } digitalWrite(_gpio, HIGH); delayMicroseconds(40); pinMode(_gpio, INPUT_PULLUP);