Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import RPi.GPIO as GPIO
  3. import time
  4.  
  5. LedPin = 19 # PIN our parallel LED's are connected to
  6. LedBlue = 17 # PIN our Third LED is connected to
  7.  
  8. def setup():
  9. GPIO.setmode(GPIO.BCM) # Numbers GPIOs by Hardware PIN #
  10.  
  11. GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
  12. GPIO.output(LedPin, False) # Set LedPin high(+3.3V) to off led
  13.  
  14. GPIO.setup(LedBlue, GPIO.OUT) #set up Blue LED as output
  15. GPIO.output(LedBlue, False) # set Blue LED to be off at start
  16.  
  17. def loop():
  18. while True:
  19. GPIO.output(LedPin, False) # Parallel LED's off
  20. time.sleep(0.5) # wait .5 seconds
  21. GPIO.output(LedBlue, True) # Blue LED On
  22. time.sleep(0.5)
  23. GPIO.output(LedBlue, False) # Blue LED off
  24. time.sleep(0.5)
  25. GPIO.output(LedPin, True) # Parallel LED's on
  26. time.sleep(0.5)
  27.  
  28. def destroy():
  29. GPIO.output(LedPin, False)
  30. GPIO.output(LedBlue, False)
  31. GPIO.cleanup() # Release resource
  32.  
  33. if __name__ == '__main__': # Program start from here
  34. setup()
  35. try:
  36. loop
  37. except KeyboardInterrupt:
  38. destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement