Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5114

Beginners • Re: Understanding PIR timeout

$
0
0

Code:

from gpiozero import MotionSensorfrom signal import pausemotion_sensor = MotionSensor(4)def motion():    print("Motion detected")def no_motion():    print("Motion stopped")print("Readying sensor...")motion_sensor.wait_for_no_motion()print("Sensor ready")motion_sensor.when_motion = motionmotion_sensor.when_no_motion = no_motionpause()
If you're going to post python code on here you need to wrap it in [code][/code] tags. I've fixed your example for you.

Statistics: Posted by DougieLawson — Sun Jul 21, 2024 10:39 am



Viewing all articles
Browse latest Browse all 5114

Trending Articles