from machine import Pin, ADC
import time

adc = ADC(0)
leds = list()
for i in range(10):
    leds.append(Pin(i, Pin.OUT))

def encender(led):
    for i in range(10):
        if i != led:
            leds[i].value(0)
        else:
            leds[i].value(1)

while 1:
    val_adc = adc.read_u16()
    #print("valor del ADC:", val_adc)
    # procesar el valor para obtener el LED a encender
    nivel = (10/65535)*val_adc
    niv_int = int(nivel)
    if niv_int == 10:
        niv_int = 9
    encender(niv_int)    
    time.sleep(0.1)

BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT