I have a sensor (PIR) connected to pin 17
and a relay in pin 27
When motion is detected the program switchs on the relay (supplying energy to a pair of torches)
and ideally, the program starts to take pictures of the thief, but only takes one, why?
when I move I can listen to the relay switching on and off
Code: Select all
from gpiozero import MotionSensor from gpiozero import LED from picamera import PiCamera from datetime import datetime pir = MotionSensor(17) relay = LED (27) camera = PiCamera() camera.rotation = 180 camera.resolution = (640, 480) timestamp = datetime.now().isoformat() while True: pir.wait_for_motion() relay.on() camera.capture('/home/pi/%s.jpg' % timestamp) pir.wait_for_no_motion() relay.off()