from machine import Pin
import time
led_bar = [
Pin(16, Pin.OUT), Pin(17, Pin.OUT), Pin(18, Pin.OUT),
Pin(19, Pin.OUT), Pin(20, Pin.OUT), Pin(21, Pin.OUT),
Pin(22, Pin.OUT), Pin(26, Pin.OUT), Pin(27, Pin.OUT),
Pin(28, Pin.OUT)
]
swl = Pin(5, Pin.IN, Pin.PULL_UP)
sw2 = Pin(14, Pin.IN, Pin.PULL_DOWN)
count = 0
while True:
if not swl.value():
if count < len(led_bar):
led_bar[count].on()
count += 1
time.sleep(0.2)
if sw2.value():
if count > 0:
count -= 1
led_bar[count].off()
time.sleep(0.2)
time.sleep(0.1)