# Write a micropython script to control the brightness of an led connected with gpio4
# with intensity of light fallen to LDR.(with respect to intensity of sunlight
#connected with gpio 34)
from machine import Pin,PWM,ADC
from time import sleep
led= PWM(Pin(4), 5000)
# frequency 1 hz to 40 MHZ
ldr= ADC(Pin(34))
ldr.width(ADC.WIDTH_10BIT)
#Resolution 12 Bit of 0
ldr.atten(ADC.ATTN_11DB)
# 3.3 V
while True:
x =ldr.read()
print(x)
led.duty(x)