from machine import ADC, Pin, PWM
from time import sleep
#analog Pins are 26, 27, 28
pot = ADC(Pin(27))
led = PWM(Pin(12))
led.freq(1000)
while True:
# ADC value starts from 0 to 65535
value = pot.read_u16()
print(value)
led.duty_u16(value)
sleep(0.5)