from machine import Pin, ADC
from time import sleep
ldr = ADC(26) # GP26 LDR
led = Pin(15, Pin.OUT)
while True:
light = ldr.read_u16()
print(light)
if light > 30000:
led.on()
else:
led.off()
sleep(0.1)from machine import Pin, ADC
from time import sleep
ldr = ADC(26) # GP26 LDR
led = Pin(15, Pin.OUT)
while True:
light = ldr.read_u16()
print(light)
if light > 30000:
led.on()
else:
led.off()
sleep(0.1)