summaryrefslogtreecommitdiff
path: root/recourses/Buzzer.py
diff options
context:
space:
mode:
authorAbdellah El Morabit <nsrddyn@gmail.com>2024-11-07 17:00:19 +0100
committerAbdellah El Morabit <nsrddyn@gmail.com>2024-11-07 17:00:19 +0100
commit32ec9336088799c42d8aa7ace6648802e1b267cf (patch)
treebc6d718631a2f2a210b4cde462a5f7f97bd6b613 /recourses/Buzzer.py
parentfa7007d00c04fc73f668e2b7f339c3f60a64d055 (diff)
did alot of designing and testing out on a linux machine
Diffstat (limited to 'recourses/Buzzer.py')
-rw-r--r--recourses/Buzzer.py56
1 files changed, 0 insertions, 56 deletions
diff --git a/recourses/Buzzer.py b/recourses/Buzzer.py
deleted file mode 100644
index 8555184..0000000
--- a/recourses/Buzzer.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-
-import RPi.GPIO as GPIO
-import time
-
-# Set #17 as buzzer pin
-BeepPin = 17
-
-def print_message():
- print("========================================")
- print ("| Beep |")
- print ("| ------------------------------ |")
- print ("| Buzzer connect to GPIO0 |")
- print ("| |")
- print ("| Make Buzzer beep |")
- print ("| |")
- print ("| |")
- print ("========================================\n")
- print 'Program is running...'
- print 'Please press Ctrl+C to end the program...'
- raw_input ("Press Enter to begin\n")
-
-def setup():
- # Set the GPIO modes to BCM Numbering
- GPIO.setmode(GPIO.BCM)
- # Set LedPin's mode to output,
- # and initial level to High(3.3v)
- GPIO.setup(BeepPin, GPIO.OUT, initial=GPIO.HIGH)
-
-def main():
- print_message()
- while True:
- # Buzzer on (Beep)
- print 'Buzzer On'
- GPIO.output(BeepPin, GPIO.LOW)
- time.sleep(0.1)
- # Buzzer off
- print 'Buzzer Off'
- GPIO.output(BeepPin, GPIO.HIGH)
- time.sleep(0.1)
-
-def destroy():
- # Turn off buzzer
- GPIO.output(BeepPin, GPIO.HIGH)
- # Release resource
- GPIO.cleanup()
-
-# If run this script directly, do:
-if __name__ == '__main__':
- setup()
- try:
- main()
- # When 'Ctrl+C' is pressed, the child program
- # destroy() will be executed.
- except KeyboardInterrupt:
- destroy() \ No newline at end of file