#script to control the LED brightness w.r.to position of pot
from machine import Pin, ADC, PWM
from time import sleep
#Configure ADC for ESP32
pot = ADC(Pin(34))
pot.width(ADC.WIDTH_10BIT)
pot.atten(ADC.ATTN_11DB)
led_pwm = PWM(Pin(5,5000)) #freq=5000
while True:
button_state=button.value()
led.value(button_state)
pot_value = pot.read()
led_pwm.duty(pot_value//4)
sleep(0.1)