from machine import Pin, PWM _init() LedPin = 15 led = Pin(LedPin, Pin.OUT) pwmLed = PWM(led) adc = machine.ADC(0) while True: value = adc.read() pwmLed.duty(value)