# Micropython version of the blink program import machine import time print("\nMicroPython example code") print("Blink the onboard LED and LED's connected to GP15 & GP16\n") # These are the Pin names. ledList = ['LED', 'GP15', 'GP16'] # Internal LED, GP15, GP16 as Pin Objects ledPinList = [ machine.Pin('LED', machine.Pin.OUT), machine.Pin('GP15', machine.Pin.OUT), machine.Pin('GP16', machine.Pin.OUT) ] ledPattern = [0, 1, 2, 1] 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) print("Turn off all LED's") turnOffLED(ledPinList) timeDelay = .25 print("Cycle LEDs") while True: print("Cycle start") for ledTarget in ledPattern: cycleLED(ledPinList[ledTarget],timeDelay) # time.sleep(1) #wait for one second