Completely new in the Raspberry Pi community, so please excuse me if this is a total noob question.
Model: Raspberry Pi 4 Model B
Component: Adafruit PIR motion sensor
I am currently following the following a simplified tutorial to hook up a PIR sensor using a 40 pin cobbler plus and breadboard: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-12-sensing-movement/hardware
I have simplified it to exclude the verify the PIR sensor value and then print out "PIR ALARM!" What ends up happening when I run the code is, even when no motion is detected, the
pir_sensor value in the code below is returning
I have adjusted both the time and sensitivity switches on the PIR sensor, but to no avail. What could I be getting wrong here?
Here is the code:
import time import board import digitalio # set up motion sensor pir_sensor = digitalio.DigitalInOut(board.D18) pir_sensor.direction = digitalio.Direction.INPUT while True: if pir_sensor.value: print("PIR ALARM!") time.sleep(0.5)