from machine import Timer, Pin
import utime
utime.sleep(0.1) # Wait for USB to become ready
red = Pin(0, Pin.OUT)
green = Pin(1, Pin.OUT)
yellow = Pin(2, Pin.OUT)
leds = [red, green, yellow]
ind = 0
def cycle_leds(t):
global ind
leds[ind].off()
ind = (ind + 1) % len(leds)
leds[ind].on()
led_timer = Timer(period=1000, mode=Timer.PERIODIC, callback=cycle_leds)