#!/usr/bin/python
#led_alternate.py
import RPi.GPIO as GPIO
import time
delay = 0.2
# Use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# Setup the channels up as outputs
GPIO.setup(11, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(22, GPIO.OUT)
def initialize():
#Setup the startup values
GPIO.output(11,GPIO.LOW)
GPIO.output(12,GPIO.LOW)
GPIO.output(15,GPIO.LOW)
GPIO.output(16,GPIO.LOW)
GPIO.output(18,GPIO.LOW)
GPIO.output(22,GPIO.LOW)
# Loop function that alternates the LED's
for y in range (0,10):
initialize()
GPIO.output(11,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(12,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(15,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(16,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(18,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(22,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(18,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(16,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(15,GPIO.HIGH)
time.sleep(delay)
initialize()
GPIO.output(12,GPIO.HIGH)
time.sleep(delay)
GPIO.cleanup()