from machine import Pin
import time
leds = [Pin(17, Pin.OUT), Pin(18, Pin.OUT), Pin(19, Pin.OUT), Pin(20, Pin.OUT), Pin(21, Pin.OUT)]
swl = Pin(5, Pin.IN, Pin.PULL_UP)
sw2 = Pin(13, Pin.IN, Pin.PULL_UP)
count = 0
while True:
if not swl.value():
if count < len(leds):
leds[count].on()
count += 1
time.sleep(0.1)
if not sw2.value():
if count > 0:
count -= 1
leds[count].off()
time.sleep(0.1)
time.sleep(0.075)