from machine import ADC, Pin
import time

# Initialize the ADC and LED
ldr = ADC(0)  # ADC0 (GP26)
led = Pin(15, Pin.OUT)  # GP15

# Threshold for low illumination
threshold = 30000

# Initial LDR value
previous_ldr_value = ldr.read_u16()

while True:
    # Read the LDR value
    ldr_value = ldr.read_u16()
    
    # Check if the illumination is low
    if ldr_value < threshold:
        led.on()  # Turn on the LED
    else:
        led.off()  # Turn off the LED
    
    # Print LDR value only if it has changed
    if ldr_value != previous_ldr_value:
        print("LDR Value:", ldr_value)
        previous_ldr_value = ldr_value
    
    # Wait for a short period
    time.sleep(0.1)
$abcdeabcde151015202530fghijfghij
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT