Advertisement
Guest User

Fish Dish Sample Code

a guest
Dec 20th, 2014
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. #!/usr/bin/python
  2. import RPi.GPIO as GPIO
  3. import time
  4.  
  5. LEDGPIOPin_Gruen = 4
  6. LEDGPIOPin_Rot = 9
  7. LEDGPIOPin_Gelb = 22
  8. LEDGPIOPin_BUZZ = 8
  9. LEDGPIOPin_BUTTON = 7
  10.  
  11.  
  12. GPIO.setmode(GPIO.BCM)
  13. GPIO.setwarnings(False)
  14.  
  15. GPIO.setup(LEDGPIOPin_Gruen, GPIO.OUT)
  16. GPIO.setup(LEDGPIOPin_Gelb, GPIO.OUT)
  17. GPIO.setup(LEDGPIOPin_Rot, GPIO.OUT)
  18.  
  19. GPIO.setup(LEDGPIOPin_BUZZ, GPIO.OUT)
  20.  
  21. GPIO.setup(LEDGPIOPin_BUTTON, GPIO.IN)
  22.  
  23.  
  24. DELAYON = 1.0
  25. DELAYBUZZ = 0.1
  26. i = 0
  27.  
  28. GPIO.output(LEDGPIOPin_Rot, GPIO.HIGH)
  29.  
  30.  
  31. while True:
  32.     if (GPIO.input(LEDGPIOPin_BUTTON) == True):
  33.             GPIO.output(LEDGPIOPin_Rot, GPIO.LOW)
  34.  
  35.             GPIO.output(LEDGPIOPin_Gelb, GPIO.HIGH)
  36.             time.sleep(DELAYON)
  37.             GPIO.output(LEDGPIOPin_Gelb, GPIO.LOW)
  38.  
  39.         GPIO.output(LEDGPIOPin_Gruen, GPIO.HIGH)
  40.         while i < 25:
  41.                 GPIO.output(LEDGPIOPin_BUZZ, GPIO.HIGH)
  42.                 time.sleep(DELAYBUZZ)
  43.                 GPIO.output(LEDGPIOPin_BUZZ, GPIO.LOW)
  44.                 time.sleep(DELAYBUZZ)
  45.             i += 1
  46.             i = 0
  47.         GPIO.output(LEDGPIOPin_Gruen, GPIO.LOW)
  48.  
  49.             GPIO.output(LEDGPIOPin_Gelb, GPIO.HIGH)
  50.             time.sleep(DELAYON)
  51.             GPIO.output(LEDGPIOPin_Gelb, GPIO.LOW)
  52.  
  53.             GPIO.output(LEDGPIOPin_Rot, GPIO.HIGH)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement