void setup() {
// put your setup code here, to run once:
Serial1.begin(115200);
Serial1.println("Hello, Raspberry Pi Pico!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(1); // this speeds up the simulation
}
rom machine import Pin, ADC
import time
ldr = ADC(Pin(26))
led = Pin(11, Pin.OUT)
threshold_dark = 1000
while True:
try:
ldr_value = ldr.read_u16()
if ldr_value < threshold_dark:
print("It's dark")
led.value(1)
else:
print("It's bright")
led.value(0)
time.sleep(1)
except KeyboardInterrupt:
break