menu_book Course Curriculum (Raspberry Pi) expand_more
Linux & Setup
GPIO Digital I/O
Sensors & Buses
Automation
Networking & Services
PIR motion sensor
Learn PIR motion sensor in Raspberry Pi with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.
12 min read
•
Advanced
raspberry-pi-046.py
python
from gpiozero import MotionSensor
pir=MotionSensor(4)
pir.wait_for_motion(); print('motion detected')
pir.wait_for_no_motion(); print('clear')
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content