Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import RPi.GPIO as GPIO
- import time
- LEDGPIOPin_Gruen = 4
- LEDGPIOPin_Rot = 9
- LEDGPIOPin_Gelb = 22
- LEDGPIOPin_BUZZ = 8
- LEDGPIOPin_BUTTON = 7
- GPIO.setmode(GPIO.BCM)
- GPIO.setwarnings(False)
- GPIO.setup(LEDGPIOPin_Gruen, GPIO.OUT)
- GPIO.setup(LEDGPIOPin_Gelb, GPIO.OUT)
- GPIO.setup(LEDGPIOPin_Rot, GPIO.OUT)
- GPIO.setup(LEDGPIOPin_BUZZ, GPIO.OUT)
- GPIO.setup(LEDGPIOPin_BUTTON, GPIO.IN)
- DELAYON = 1.0
- DELAYBUZZ = 0.1
- i = 0
- GPIO.output(LEDGPIOPin_Rot, GPIO.HIGH)
- while True:
- if (GPIO.input(LEDGPIOPin_BUTTON) == True):
- GPIO.output(LEDGPIOPin_Rot, GPIO.LOW)
- GPIO.output(LEDGPIOPin_Gelb, GPIO.HIGH)
- time.sleep(DELAYON)
- GPIO.output(LEDGPIOPin_Gelb, GPIO.LOW)
- GPIO.output(LEDGPIOPin_Gruen, GPIO.HIGH)
- while i < 25:
- GPIO.output(LEDGPIOPin_BUZZ, GPIO.HIGH)
- time.sleep(DELAYBUZZ)
- GPIO.output(LEDGPIOPin_BUZZ, GPIO.LOW)
- time.sleep(DELAYBUZZ)
- i += 1
- i = 0
- GPIO.output(LEDGPIOPin_Gruen, GPIO.LOW)
- GPIO.output(LEDGPIOPin_Gelb, GPIO.HIGH)
- time.sleep(DELAYON)
- GPIO.output(LEDGPIOPin_Gelb, GPIO.LOW)
- GPIO.output(LEDGPIOPin_Rot, GPIO.HIGH)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement