import board
import digitalio
import time
# Setup for pins
pir = digitalio.DigitalInOut(board.GP20)
pir.direction = digitalio.Direction.INPUT
led_yellow = digitalio.DigitalInOut(board.GP9)
led_yellow.direction = digitalio.Direction.OUTPUT
led_blue = digitalio.DigitalInOut(board.GP4)
led_blue.direction = digitalio.Direction.OUTPUT
print("Movement Detection")
while True:
# Check the state of the PIR sensor
if pir.value:
led_blue.value = True # Turn on blue LED
led_yellow.value = False # Turn off yellow LED
print("Movement Detected")
else:
led_blue.value = False # Turn off blue LED
led_yellow.value = True # Turn on yellow LED
print("Movement not Detected")
time.sleep(1) # Delay for 1 second