-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)
1
  • Where is .count being defined? May 13, 2016 at 21:06

1 Answer 1

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.