from machine import Pin
import time
Leds = [Pin(5,Pin.OUT),Pin(4,Pin.OUT),Pin(17,Pin.OUT)]
p_button=Pin(13,Pin.IN)
def cycle(Leds):
for Led in range(len(Leds)):
if Led == 0:
Leds[Led].value(1)
time.sleep_ms(500)
else:
Leds[Led-1].value(0)
Leds[Led].value(1)
time.sleep_ms(500)
Leds[0].value(0)
Leds[1].value(0)
Leds[2].value(0)
while True:
press=p_button.value()
if press == True:
cycle(Leds)