from machine import Pin, ADC
import time

# GP numbers: change to match your wiring
LED_PIN = 15
LDR_PIN = 27                 # must be GP26, GP27, or GP28 (analog pins)

led = Pin(LED_PIN, Pin.OUT)
ldr = ADC(LDR_PIN)

DARK = 35000                 # threshold: set this from your own readings

while True:
    light = ldr.read_u16()   # 0 (dark) to 65535 (bright)
    print(light)
    if light < DARK:         # dark: turn the LED on
        led.value(1)
    else:                    # bright: turn the LED off
        led.value(0)
    time.sleep(0.2)
