31 lines
563 B
Python
31 lines
563 B
Python
import atexit
|
|
import RPi.GPIO as GPIO
|
|
|
|
from compLib.LogstashLogging import Logging
|
|
|
|
GPIO.setwarnings(False)
|
|
Buzzer_Pin = 17
|
|
GPIO.setmode(GPIO.BCM)
|
|
GPIO.setup(Buzzer_Pin, GPIO.OUT)
|
|
|
|
|
|
class Buzzer:
|
|
"""Used to interact with the buzzer
|
|
"""
|
|
|
|
@staticmethod
|
|
def set(on: bool):
|
|
"""Turn the buzzer on / off
|
|
|
|
: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(False)
|
|
|
|
|
|
atexit.register(Buzzer.exit)
|