import machine
import time
# Define the pin to which the PIR sensor is connected
pir_pin = machine.Pin(14, machine.Pin.IN)
while True:
# Read the PIR sensor's output
motion_detected = pir_pin.value()
if motion_detected:
print("Motion detected!")
# Perform an action when motion is detected, e.g., turn on an LED
else:
print("No motion detected.")
# Add a delay to avoid false positives
time.sleep(2) # Adjust the delay as needed