Make A File For The Script:
nano 8channel.py
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# GPIO | Relay
#*************
#*************
# 13 01
# 19 02
# 20 03
# 21 04
# 22 05
# 23 06
# 26 07
# 27 08
# Initiate List With Pin GPIO Pin Numbers
gpioList = [13, 19, 20, 21, 22, 23, 26, 27] #Update GPIO To What Is Being Used
for i in gpioList:
GPIO.setup(i, GPIO.OUT)
GPIO.output(i, GPIO.HIGH)
# Sleep Time Variables
sleepTimeShort = 0.2 #Change Time
sleepTimeLong = 0.1 #Change Time
# MAIN LOOP *****
# ***************
try:
while True:
for i in gpioList:
GPIO.output(i, GPIO.LOW)
time.sleep(sleepTimeShort);
GPIO.output(i, GPIO.HIGH)
time.sleep(sleepTimeLong);
# End Program Cleanly With Keyboard
except KeyboardInterrupt:
print " Quit"
# Reset GPIO Settings
GPIO.cleanup()
To Run The Script:
python 8channel.py