Advertisement
gPiOBox

Utility - gPiO Box Test - Raspberry Pi

Oct 22nd, 2017
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. """
  2. filename:gpio_RPi_Box_Test.py
  3. Utility gPiO Box Test Code
  4. written by Trevor Olsson
  5. © GPIO Support Services LTD MMXVII
  6. """
  7. from gpiozero import Button, LED
  8. from time import sleep
  9.  
  10. INA = Button(4,pull_up=False)
  11. INB = Button(14,pull_up=False)
  12. INC = Button(15,pull_up=False)
  13. IND = Button(25,pull_up=False)
  14.  
  15. OUT1 = LED(17)
  16. OUT2 = LED(18)
  17. OUT3 = LED(27)
  18. OUT4 = LED(22)
  19. OUT5 = LED(23)
  20. OUT6 = LED(24)
  21.  
  22. while True:
  23.     if INA.is_pressed:
  24.         OUT1.on()
  25.         sleep(1)
  26.         OUT1.off()
  27.     if INB.is_pressed:
  28.         OUT2.on()
  29.         sleep(1)
  30.         OUT2.off()
  31.     if INC.is_pressed:
  32.         OUT3.on()
  33.         sleep(1)
  34.         OUT3.off()
  35.     if IND.is_pressed:
  36.         OUT4.on()
  37.         sleep(1)
  38.         OUT4.off()
  39.         OUT5.on()
  40.         sleep(1)
  41.         OUT5.off()
  42.         OUT6.on()
  43.         sleep(1)
  44.         OUT6.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement