Add more logging and exception

This commit is contained in:
Konstantin Lampalzer 2021-01-21 16:43:01 +00:00
parent cb10bb3a4d
commit ce1c82a192
8 changed files with 56 additions and 19 deletions

View file

@ -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)