FIX: Fix GPIO handler
This commit is contained in:
parent
24ae8d42eb
commit
e3e91ab1b5
|
@ -43,19 +43,6 @@ class GPIOHandler(Thread):
|
|||
self.core = core
|
||||
self.stop_event = stop_event
|
||||
|
||||
# pylint: disable=no-member
|
||||
def init_gpio(self):
|
||||
'''
|
||||
Initialize the GPIO button pins and LED pin.
|
||||
'''
|
||||
GPIO.setmode(GPIO.BOARD)
|
||||
|
||||
for pin in self.button_pins:
|
||||
GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||
|
||||
GPIO.setup(self.led_pin, GPIO.OUT)
|
||||
GPIO.output(self.led_pin, GPIO.HIGH)
|
||||
|
||||
def run(self):
|
||||
'''
|
||||
Run the thread.
|
||||
|
@ -66,7 +53,7 @@ class GPIOHandler(Thread):
|
|||
play_sound('success.wav')
|
||||
self.button_pins[pin](self.core)
|
||||
|
||||
for pin in self.button_pins.values():
|
||||
for pin in self.button_pins:
|
||||
GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||
GPIO.add_event_detect(pin, GPIO.BOTH, callback=callback)
|
||||
|
||||
|
|
Loading…
Reference in a new issue