i received a lot of help to the Raspberry Pi study for yours thank you so much!! :)

but there is a problem to me.

i hope as follow 1. The record run 2. If the vibration sensor is detected during the recording, the recording should stop running 3. and the recording starts and againg in a different title.

Python source under are as follows vibration detect -> the picture are taken

Beneath the source is not a problem. but i don't know how to code the recording source...

ex) camera.start_recording("123.h264") camera.wait_recording(24*60*60) camera.stop_recording() ->>> is only recorded. During recording, the sensor is not detected..

What should i do...??
I've continued to find on Google, did not find....

import RPi.GPIO as GPIO
import datatime
import picamera
from time import sleep

GPIO.setup(6, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)

camera = picamera.PiCamera()

while True:
   now = datetime.datetime.now()
   result = GPIO.input(6)
   if result == 1:
      camera.capture("%d-%d-%d %d:%d:%d.jpg' &(now.year, now.month, now.day, now.hour, now.minute, now.second)
  • Where is .count being defined? – Mohammad Ali May 13 '16 at 21:06

Well firstly you have not defined the pin mode which is how it tells if you want a physical number (1-40) to define your pin with or the Broadcom SOC channel numbering. You can change this with GPIO.setmode(GPIO.BCM) or, GPIO.setmode(GPIO.BOARD). Also according to this the RPiGPIO module is unsuitable for real time or critical timing applications which is kinda what your doing with the camera reacting to the sensor.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.