Expanded verbose options

This commit is contained in:
Jan
2019-09-26 23:39:32 +02:00
parent eaaeadf642
commit 124ab39f82
2 changed files with 42 additions and 24 deletions

View File

@@ -16,8 +16,9 @@ class Button:
presstime=0
ignore=0
def __init__(self, gpio):
print("initialize button on gpio %d" %gpio)
def __init__(self, gpio,verbose=False):
if verbose:
print("initialize button on gpio %d" %gpio)
self.gpio = gpio
GPIO.setup(self.gpio, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.add_event_detect(self.gpio, GPIO.BOTH, callback=self.my_callback)