From 3faf6ab9eb1b243aa4b46f22b7af3d60242b6910 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Fri, 20 Nov 2020 19:30:34 +0300 Subject: [PATCH] Fixing DHT InputPullUp to Input only (#1293) * Fixing DHT InputPullUp * Adjusting pinmode --- src/devices/Dhtxx/DhtBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/devices/Dhtxx/DhtBase.cs b/src/devices/Dhtxx/DhtBase.cs index 7d7357bb..ba8bdb79 100644 --- a/src/devices/Dhtxx/DhtBase.cs +++ b/src/devices/Dhtxx/DhtBase.cs @@ -145,6 +145,7 @@ namespace Iot.Device.DHTxx byte readVal = 0; uint count; + var pinMode = _controller.IsPinModeSupported(_pin, PinMode.InputPullUp) ? PinMode.InputPullUp : PinMode.Input; // keep data line HIGH _controller.SetPinMode(_pin, PinMode.Output); @@ -162,7 +163,7 @@ namespace Iot.Device.DHTxx // wait 20 - 40 microseconds DelayHelper.DelayMicroseconds(30, true); - _controller.SetPinMode(_pin, PinMode.InputPullUp); + _controller.SetPinMode(_pin, pinMode); // DHT corresponding signal - LOW - about 80 microseconds count = _loopCount; -- GitLab