from machine import Pin,ADC,PWM
from time import sleep
Led_pin = 0
Potentiometer_pin = 0 # El pin de multiplexación del ADC0 es GP26
def setup():
global LED
global Pot_ADC
LED = PWM(Pin(Led_pin))
LED.freq(2000) # Establezca la frecuencia de funcionamiento del LED a 2 KHz
Pot_ADC = ADC(Potentiometer_pin)
def loop():
while True:
print ('Potentiometer Value:', Pot_ADC.read_u16())
Value = Pot_ADC.read_u16()
LED.duty_u16(Value)
sleep(0.2)
if __name__ == '__main__':
setup()
loop()