def __init__(self, pin):
GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(pin, GPIO.BOTH, callback=self._gpio_event)
self._pin = pin
self._pressed = False
self._was_pressed = False
self._was_released = False
评论列表
文章目录