#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# Initiate List With Pin GPIO Pin Numbers
gpioList = [4, 6, 22, 26] #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.5 #Change Time
sleepTimeLong = 0.5 #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);
^G Get Help ^O Write Out ^W Where Is ^K Cut Text ^J Justify ^C Cur Pos
^X Exit ^R Read File ^\ Replace ^U Uncut Text ^T To Spell ^_ Go To Line
GNU nano 3.2 4channel.py
sleepTimeShort = 0.5 #Change Time
sleepTimeLong = 0.5 #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()
This Relay Pi Hat Uses The Following GPIO Pins: 4, 6, 22, 26
Amazon Relay Link: Click Here