from machine import Pin,ADC,PWM
from time import sleep
LDR=ADC(Pin(34))
LDR.atten(ADC.ATTN_11DB)
freq=10000
led1=PWM(Pin(4,freq))
while True:
ldr_val=LDR.read()
print(ldr_val)
duty_cycle = int(ldr_val/4)
led1.duty(duty_cycle)
sleep(0.1)