more ladder board python stuff

To expand on previous posts on this topic,  you can assign variables to the pin numbers as in the following program

 

 

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)

# su[ress warnings
GPIO.setwarnings(False)

# cleanup
GPIO.cleanup()

#set pins up for output

GPIO.setup(7, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(22, GPIO.OUT)

#set globals

blue1 = 7
blue2 = 22
red1 = 12
red2 = 11
yellow1 = 15
yellow2 = 13
green1 = 16
green2 = 18

#turn leds on using above variables

GPIO.output(blue1, True)
GPIO.output(blue2, True)
time.sleep(.5)
GPIO.output(red1, True)
GPIO.output(red2, True)
time.sleep(.5)
GPIO.output(green1, True)
GPIO.output(green2, True)
time.sleep(.5)
GPIO.output(yellow1, True)
GPIO.output(yellow2, True)
time.sleep(.5)
#add delay

time.sleep(.5)

#turn leds off using above variables

GPIO.output(blue1, False)
GPIO.output(blue2, False)

GPIO.output(red1, False)
GPIO.output(red2, False)

GPIO.output(green1, False)
GPIO.output(green2, False)

GPIO.output(yellow1, False)
GPIO.output(yellow2, False)

 

 

In further enhancements I have also assigned a variable to delay  as in

delay = .25

then used

time.sleep(delay)