Add more logging and exception
This commit is contained in:
parent
cb10bb3a4d
commit
ce1c82a192
8 changed files with 56 additions and 19 deletions
|
@ -1,7 +1,8 @@
|
|||
import atexit
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
from compLib.LogstashLogging import Logging
|
||||
|
||||
GPIO.setwarnings(False)
|
||||
Buzzer_Pin = 17
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
|
@ -18,11 +19,13 @@ class Buzzer:
|
|||
|
||||
:param on: True if on, False if off
|
||||
"""
|
||||
Logging.get_logger().debug(f"Buzzer.set {on}")
|
||||
|
||||
GPIO.output(Buzzer_Pin, on)
|
||||
|
||||
@staticmethod
|
||||
def exit():
|
||||
Buzzer.set(0)
|
||||
Buzzer.set(False)
|
||||
|
||||
|
||||
atexit.register(Buzzer.exit)
|
||||
|
|
Reference in a new issue