# Write a micropython script to control the led brightness with respect to potentiometer value.
from machine import Pin, ADC, PWM
from time import sleep
led = Pin(14, Pin.OUT)
pot = ADC(Pin(15))
pot.width(ADC.WIDTH_10BIT)
pot.atten(ADC.ATTN_11DB)
led_pwm = PWM(Pin(14))
while True:
pot_value = pot.read()
led_pwm.duty(pot_value)
sleep(0.1)