from utime import sleep
from machine import Pin
from machine import ADC
sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
led = Pin(5, Pin.OUT)
LDR_PIN = 26
adc = ADC(0)
try:
while True:
led.value(1)
ldr_value = adc.read_u16()
print("LDR Value:", ldr_value)
led.value(0)
ldr_value = adc.read_u16()
print("LDR Value:", ldr_value)
sleep(1) # Adjust the interval as needed
except KeyboardInterrupt:
pass # Stop the simulation when KeyboardInterrupt occurs