-2

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

count=0
GPIO.setup(6, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
sleep(0.1)

camera = picamera.PiCamera()

while True:
   now = datetime.datetime.now()
   result = GPIO.input(6)
   if result == 1:
      print("Vibrated".count)
      count+=1
      camera.capture("%d-%d-%d %d:%d:%d.jpg' &(now.year, now.month, now.day, now.hour, now.minute, now.second)

closed as unclear what you're asking by Aurora0001, Steve Robillard, techraf, Ghanima Feb 25 '18 at 15:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Where is .count being defined? – Mohammad Ali May 13 '16 at 21:06
0

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.

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