from machine import ADC, Pin
import time
ldr = ADC(26) # ADC0 on GP26
led = Pin(15, Pin.OUT)
threshold = 30000 # example threshold; adjust after observing readings
while True:
light_value = ldr.read_u16() # 0..65535
print("Light Intensity:", light_value)
if light_value < threshold:
led.value(1) # low light -> LED ON
else:
led.value(0)
time.sleep(1)