mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
Make buzzer GPIO an Int
Fixes buzzer initialization errors
This commit is contained in:
@@ -13,12 +13,13 @@ class Buzzer(object):
|
|||||||
def __init__(self, gpio):
|
def __init__(self, gpio):
|
||||||
try:
|
try:
|
||||||
cbpi.app.logger.info("INIT BUZZER NOW GPIO%s" % gpio)
|
cbpi.app.logger.info("INIT BUZZER NOW GPIO%s" % gpio)
|
||||||
self.gpio = gpio
|
self.gpio = int(gpio)
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setup(gpio, GPIO.OUT)
|
GPIO.setup(self.gpio, GPIO.OUT)
|
||||||
self.state = True
|
self.state = True
|
||||||
cbpi.app.logger.info("BUZZER SETUP OK")
|
cbpi.app.logger.info("BUZZER SETUP OK")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
cbpi.app.logger.info("BUZZER EXCEPTION %s" % str(e))
|
||||||
self.state = False
|
self.state = False
|
||||||
|
|
||||||
def beep(self):
|
def beep(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user