# write a micropython script to control the brightness of led connected to gpio4
# with respect to the intensity of the light falling on the ldr connected to gpio34
# (if the intensity of the sunlight is more brightness of led should less)
from machine import Pin,ADC,PWM
from time import sleep
led=PWM(Pin(4),5000)
ldr=ADC(Pin(34))
ldr.width(ADC.WIDTH_10BIT)
ldr.atten(ADC.ATTN_11DB)
while True:
x=ldr.read()
print(x)
led.duty(1023-x)