from machine import Pin
from time import sleep
pir = Pin(12,Pin.IN)
while True:
if pir.value():
print(f"Motion detected!")
# Turn on LED
led.on()
else:
print(f"No motion!")
#Turn off LED
led.off()
sleep(2)
from machine import Pin
from time import sleep
pir = Pin(12,Pin.IN)
while True:
if pir.value():
print(f"Motion detected!")
# Turn on LED
led.on()
else:
print(f"No motion!")
#Turn off LED
led.off()
sleep(2)