未验证 提交 3faf6ab9 编写于 作者: L Laurent Ellerbach 提交者: GitHub

Fixing DHT InputPullUp to Input only (#1293)

* Fixing DHT InputPullUp

* Adjusting pinmode
上级 51b50dd6
...@@ -145,6 +145,7 @@ namespace Iot.Device.DHTxx ...@@ -145,6 +145,7 @@ namespace Iot.Device.DHTxx
byte readVal = 0; byte readVal = 0;
uint count; uint count;
var pinMode = _controller.IsPinModeSupported(_pin, PinMode.InputPullUp) ? PinMode.InputPullUp : PinMode.Input;
// keep data line HIGH // keep data line HIGH
_controller.SetPinMode(_pin, PinMode.Output); _controller.SetPinMode(_pin, PinMode.Output);
...@@ -162,7 +163,7 @@ namespace Iot.Device.DHTxx ...@@ -162,7 +163,7 @@ namespace Iot.Device.DHTxx
// wait 20 - 40 microseconds // wait 20 - 40 microseconds
DelayHelper.DelayMicroseconds(30, true); DelayHelper.DelayMicroseconds(30, true);
_controller.SetPinMode(_pin, PinMode.InputPullUp); _controller.SetPinMode(_pin, pinMode);
// DHT corresponding signal - LOW - about 80 microseconds // DHT corresponding signal - LOW - about 80 microseconds
count = _loopCount; count = _loopCount;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册