from machine import ADC, Pin
from time import sleep
led1= Pin(1, Pin.OUT) # this is the built-in LED on the Pico
led2= Pin(2, Pin.OUT)
led3= Pin(3, Pin.OUT)
led4= Pin(4, Pin.OUT)
pot = ADC(Pin(26)) # ADC0 is GPIO 26. Connect to row 10 the right side
while 1:
pot_value = pot.read_u16() # read the value from the pot
flash_delay = pot_value/65535
volt=pot_value/65535*3.300
print ("voltage:", volt)
print("pot_value:",pot_value)
led1.on()
led2.on()
led3.on()
led4.on()
sleep(flash_delay)
led1.off()
led2.off()
led3.off()
led4.off()
sleep(flash_delay)