Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion adafruit_dht.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ def _get_pulses_bitbang(self):
timestamp = time.monotonic() # take timestamp
dhtval = True # start with dht pin true because its pulled up
dhtpin.direction = Direction.INPUT
dhtpin.pull = Pull.UP

try:
dhtpin.pull = Pull.UP
# Catch the NotImplementedError raised because
# blinka.microcontroller.generic_linux.libgpiod_pin does not support
# internal pull resistors.
except NotImplementedError:
dhtpin.pull = None

while time.monotonic() - timestamp < 0.25:
if dhtval != dhtpin.value:
dhtval = not dhtval # we toggled
Expand Down