# write a micropython script to control the brightness of an led connected to GPIO 4with respact to the position of the potnstiometer knob connected to pin 34 of esp32 .
# Write a micropython script to control the brightness of the led connected to GPIO 4 with respact to the intensity of the sun light falling in ldr (intensity of sun light of the more brightness of the led should be less).
from machine import Pin,PWM,ADC
from time import sleep
led=PWM(Pin(4),5000)#f=1hz to 40 MHz
ldr=ADC(Pin(34))
ldr.width(ADC.WIDTH_10BIT)#Resolution :12bit:0-1023
ldr.atten(ADC.ATTN_11DB)#3.3v
while True:
x=ldr.read()
print(x)
led.duty(x)