Added destructor to disable buzzer at exit

This commit is contained in:
HerrNamenlos123 2021-01-15 22:55:52 +01:00
parent e571a7c97e
commit 71a3decedf

View file

@ -1,4 +1,5 @@
import RPi.GPIO as GPIO
import atexit
GPIO.setwarnings(False)
Buzzer_Pin = 17
@ -15,4 +16,9 @@ class Buzzer:
:param on: True if on, False if off
:return: None
"""
GPIO.output(Buzzer_Pin, on)
GPIO.output(Buzzer_Pin, on)
def exit():
Buzzer.set(0)
atexit.register(exit)