Repository: skiwithpete/relaypi Branch: master Commit: 924a3edf7178 Files: 16 Total size: 14.7 KB Directory structure: gitextract_lx1qjv2e/ ├── 16port/ │ ├── script16_1.py │ ├── script16_2.py │ ├── script16_3.py │ ├── script16_4.py │ └── script16_5.py ├── 4port/ │ ├── script1.py │ ├── script2.py │ ├── script3.py │ ├── script4.py │ ├── script5.py │ └── script5a.py └── 8port/ ├── script1.py ├── script2.py ├── script3.py ├── script4.py └── script5.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: 16port/script16_1.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26, 21, 20] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 2 # main loop try: GPIO.output(2, GPIO.LOW) print ("ONE") time.sleep(SleepTimeL); GPIO.output(3, GPIO.LOW) print ("TWO") time.sleep(SleepTimeL); GPIO.output(4, GPIO.LOW) print ("THREE") time.sleep(SleepTimeL); GPIO.output(17, GPIO.LOW) print ("FOUR") time.sleep(SleepTimeL); GPIO.output(27, GPIO.LOW) print ("FIVE") time.sleep(SleepTimeL); GPIO.output(22, GPIO.LOW) print ("SIX") time.sleep(SleepTimeL); GPIO.output(10, GPIO.LOW) print ("SEVEN") time.sleep(SleepTimeL); GPIO.output(9, GPIO.LOW) print ("EIGHT") time.sleep(SleepTimeL); GPIO.output(11, GPIO.LOW) print ("NINE") time.sleep(SleepTimeL); GPIO.output(5, GPIO.LOW) print ("TEN") time.sleep(SleepTimeL); GPIO.output(6, GPIO.LOW) print ("ELEVEN") time.sleep(SleepTimeL); GPIO.output(13, GPIO.LOW) print ("TWELVE") time.sleep(SleepTimeL); GPIO.output(19, GPIO.LOW) print ("THIRTEEN") time.sleep(SleepTimeL); GPIO.output(26, GPIO.LOW) print ("FOURTEEN") time.sleep(SleepTimeL); GPIO.output(21, GPIO.LOW) print ("FIFTEEN") time.sleep(SleepTimeL); GPIO.output(20, GPIO.LOW) print ("SIXTEEN") time.sleep(SleepTimeL); GPIO.cleanup() print ("Good bye!") # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 16port/script16_2.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26, 21, 20] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: while True: for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(i, GPIO.LOW) pinList.reverse() for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(i, GPIO.LOW) pinList.reverse() # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 16port/script16_3.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26, 21, 20] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: while True: for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); pinList.reverse() for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeL); pinList.reverse() # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 16port/script16_4.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26, 21, 20] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: count = 9 while (count > 0): print (' The count is:', count) for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeL); pinList.reverse() for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); pinList.reverse() count = count - 1 # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 16port/script16_5.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26, 21, 20] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeS = 0.2 SleepTimeL = 0.5 # main loop try: while True: for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeS); GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeS); GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeS); GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 4port/script1.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17] # loop through pins and set mode and state to 'high' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 2 # main loop try: GPIO.output(2, GPIO.LOW) print ("ONE") time.sleep(SleepTimeL); GPIO.output(3, GPIO.LOW) print ("TWO") time.sleep(SleepTimeL); GPIO.output(4, GPIO.LOW) print ("THREE") time.sleep(SleepTimeL); GPIO.output(17, GPIO.LOW) print ("FOUR") time.sleep(SleepTimeL); GPIO.cleanup() print ("Good bye!") # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/WpM1aq4B8-A ================================================ FILE: 4port/script2.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17] # loop through pins and set mode and state to 'high' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeS = 0.1 # main loop try: while True: for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeS); for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeS); pinList.reverse() # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/WpM1aq4B8-A ================================================ FILE: 4port/script3.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17] # loop through pins and set mode and state to 'high' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: GPIO.output(2, GPIO.LOW) time.sleep(SleepTimeL); GPIO.output(3, GPIO.LOW) time.sleep(SleepTimeL); GPIO.output(4, GPIO.LOW) time.sleep(SleepTimeL); GPIO.output(17, GPIO.LOW) time.sleep(SleepTimeL); GPIO.output(3, GPIO.HIGH) GPIO.output(4, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(2, GPIO.HIGH) GPIO.output(17, GPIO.HIGH) GPIO.output(3, GPIO.LOW) GPIO.output(4, GPIO.LOW) time.sleep(SleepTimeL); GPIO.output(2, GPIO.LOW) GPIO.output(17, GPIO.LOW) GPIO.output(3, GPIO.HIGH) GPIO.output(4, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(3, GPIO.LOW) GPIO.output(4, GPIO.LOW) time.sleep(SleepTimeL); GPIO.output(2, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(3, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(4, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(17, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.cleanup() print ("Good bye!") # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/WpM1aq4B8-A ================================================ FILE: 4port/script4.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [3] # loop through pins and set mode and state to 'high' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: count = 9 while (count > 0): print (' The count is:', count) for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeL); pinList.reverse() for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); pinList.reverse() count = count - 1 # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/WpM1aq4B8-A ================================================ FILE: 4port/script5.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [3] # loop through pins and set mode and state to 'high' for i in pinList: GPIO.setup(i, GPIO.OUT) # GPIO.output(i, GPIO.HIGH) # main loop try: GPIO.output(3, GPIO.LOW) print ("ON") # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/WpM1aq4B8-A ================================================ FILE: 4port/script5a.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [3] # loop through pins and set mode and state to 'high' for i in pinList: GPIO.setup(i, GPIO.OUT) # GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeS = 0.2 SleepTimeL = 0.5 # main loop try: GPIO.output(3, GPIO.HIGH) print ("OFF") # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/WpM1aq4B8-A ================================================ FILE: 8port/script1.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 2 # main loop try: GPIO.output(2, GPIO.LOW) print ("ONE") time.sleep(SleepTimeL); GPIO.output(3, GPIO.LOW) print ("TWO") time.sleep(SleepTimeL); GPIO.output(4, GPIO.LOW) print ("THREE") time.sleep(SleepTimeL); GPIO.output(17, GPIO.LOW) print ("FOUR") time.sleep(SleepTimeL); GPIO.output(27, GPIO.LOW) print ("FIVE") time.sleep(SleepTimeL); GPIO.output(22, GPIO.LOW) print ("SIX") time.sleep(SleepTimeL); GPIO.output(10, GPIO.LOW) print ("SEVEN") time.sleep(SleepTimeL); GPIO.output(9, GPIO.LOW) print ("EIGHT") time.sleep(SleepTimeL); GPIO.cleanup() print ("Good bye!") # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 8port/script2.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: while True: for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(i, GPIO.LOW) pinList.reverse() for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); GPIO.output(i, GPIO.LOW) pinList.reverse() # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 8port/script3.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: while True: for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); pinList.reverse() for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeL); pinList.reverse() # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 8port/script4.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeL = 0.2 # main loop try: count = 9 while (count > 0): print (' The count is:'), count for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeL); pinList.reverse() for i in pinList: GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); pinList.reverse() count = count - 1 # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g ================================================ FILE: 8port/script5.py ================================================ #!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # init list with pin numbers pinList = [2, 3, 4, 17, 27, 22, 10, 9] # loop through pins and set mode and state to 'low' for i in pinList: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) # time to sleep between operations in the main loop SleepTimeS = 0.2 SleepTimeL = 0.5 # main loop try: while True: for i in pinList: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeS); GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeS); GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeS); GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); # End program cleanly with keyboard except KeyboardInterrupt: print (" Quit") # Reset GPIO settings GPIO.cleanup() # find more information on this script at # http://youtu.be/oaf_zQcrg7g