from machine import Pin,ADC,PWM
from time import sleep
led = Pin(2, Pin.OUT)
# ci=onfigure ADC for ESP32
pot =ADC(Pin(34))
pot.width(ADC.WIDTH_10BIT)
pot.atten(ADC.ATTN_11DB)
led_pwm=PWM(Pin(4),5000)
while True:
pot_value=pot.read()
led_pwm.duty(pot_value)
sleep(0.1)