diff --git a/src/devices/Dhtxx/DhtBase.cs b/src/devices/Dhtxx/DhtBase.cs index 7d7357bb0b2bd8faae24c0ea8933f436b6a62e10..ba8bdb795803171d4fc3ba566b32cab8fd4024cd 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;