SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 367 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from gpiozero import MotionSensor
  2. from picamera import PiCamera
  3. from time import time
  4. from time import sleep
  5. from datetime import datetime
  6.  
  7. pir = MotionSensor(26)
  8. camera=PiCamera()
  9. camera.start_preview()
  10. sleep(2)
  11.  
  12. while True:
  13.         camera.resolution=(2592,1944)
  14.         print('wait for motion')
  15.         pir.wait_for_motion()
  16.         print('motion detected')
  17.         now=datetime.now().strftime('%Y%m%d_%H%M%S')
  18.         camera.capture('/home/pi/Desktop/TRAP/'+now+'.jpg',quality=100)
  19.         print('frame captured')
  20.         pir.wait_for_no_motion()
  21.         print('motion ended')
  22.         camera.resolution=(1920,1080)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top