# Program for CircuitPython on a Pico W

import board
import digitalio
import time

print("\nCircuitPython example code")
print("Cycle the onboard LED and LED's connected to GP15 & GP16\n")


ledList = ['LED', 'GP15', 'GP16']
ledPinList = [
digitalio.DigitalInOut(board.LED),
digitalio.DigitalInOut(board.GP15),
digitalio.DigitalInOut(board.GP16)
]

def cycleLED(ledID,timeDelay):
    ledID.value = True
    time.sleep(timeDelay)
    ledID.value = False 
    time.sleep(timeDelay)
    
def turnOffLED(ledPinList):
    for pinID in ledPinList:
        pinID.value = False


for pinID in ledPinList:
	pinID.direction = digitalio.Direction.OUTPUT

print("Turn off all LED's")
turnOffLED(ledPinList)

timeDelay = .25
print("Cycle LEDs")  

while True:
  
  print("Cycle start")
  cycleLED(ledPinList[0],timeDelay)
  cycleLED(ledPinList[1],timeDelay)
  cycleLED(ledPinList[2],timeDelay)
  cycleLED(ledPinList[1],timeDelay)
  
#  time.sleep(1)   #wait for one second


