import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
from machine import Pin, ADC
pot = ADC(Pin(26))
leds =[
Pin(6, Pin.OUT),
Pin(7, Pin.OUT),
Pin(8, Pin.OUT),
Pin(9, Pin.OUT),
Pin(10, Pin.OUT),
Pin(11, Pin.OUT),
Pin(12, Pin.OUT),
Pin(13, Pin.OUT),
Pin(14, Pin.OUT),
Pin(15, Pin.OUT)
]
while True:
time.sleep(0.1)
value = pot.read_u16()
led_index = int(value / 45000 * 9)
for i in range(10):
if i < led_index: leds[i].on()
else: leds[i].off()