# Digital sensor data
# Reading and showing the output of a PIR motion sensor
# Connect the PIR motion sensor to the Pico
# Vcc connects to power (either 3.3V or 5V for this sensor)
# Out connects to pin GP28
# GND connects to any ground pin on the Pico
# Use the code provided or create your own
from machine import Pin
from time import sleep
pir_pin = Pin(22, Pin.IN)
led_pin = Pin (21, Pin.OUT)
while True:
if pir_pin.value():
print("Motion detected!")
led_pin.value(1)
sleep(1)
led_pin.value(0)