File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 31
31
import array
32
32
import time
33
33
from os import uname
34
- from digitalio import DigitalInOut , Direction
34
+ from digitalio import DigitalInOut , Pull , Direction
35
35
36
36
_USE_PULSEIO = False
37
37
try :
@@ -160,7 +160,15 @@ def _get_pulses_bitbang(self):
160
160
timestamp = time .monotonic () # take timestamp
161
161
dhtval = True # start with dht pin true because its pulled up
162
162
dhtpin .direction = Direction .INPUT
163
- dhtpin .pull = None
163
+
164
+ try :
165
+ dhtpin .pull = Pull .UP
166
+ # Catch the NotImplementedError raised because
167
+ # blinka.microcontroller.generic_linux.libgpiod_pin does not support
168
+ # internal pull resistors.
169
+ except NotImplementedError :
170
+ dhtpin .pull = None
171
+
164
172
while time .monotonic () - timestamp < 0.25 :
165
173
if dhtval != dhtpin .value :
166
174
dhtval = not dhtval # we toggled
You can’t perform that action at this time.
0 commit comments