Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions Code/Server/Buzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
Buzzer_Pin = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(Buzzer_Pin,GPIO.OUT)

class Buzzer:
def run(self,command):
def run(self, command):
if command!="0":
GPIO.output(Buzzer_Pin,True)
GPIO.output(Buzzer_Pin, True)
else:
GPIO.output(Buzzer_Pin,False)
GPIO.output(Buzzer_Pin, False)

def __del__(self):
'Make sure the sound goes off once a program terminates'
GPIO.output(Buzzer_Pin, False)


if __name__=='__main__':
B=Buzzer()
print('Activate Buzzer and wait for 1s')
B.run('1')
time.sleep(3)
B.run('0')




time.sleep(1)