Added destructor to disable buzzer at exit
This commit is contained in:
parent
e571a7c97e
commit
71a3decedf
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
Reference in a new issue