I am not very familiar with any of raspberry pi product or the scripts used to program them.
The result i am trying to accomplish:
- I am trying to create a camera with a trigger switch for recording. (when trigger pressed the camera records, when released the camera stops recording).
- Trigger switch input is 3v when not pressed & 0v when pressed.
- The script should run every time the raspberry pi is turned on.
The script that i used: ((sample.py) - saved file name)
Code: Select all
import time import datetime import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(29,GPIO.IN,pull_up_down=GPIO.PUD.UP) def startrecording() raspivid -t 600000 -ex auto -b 17000000 -o /home/pi/t1_'date+%d%m%Y_%H%M-%S'.h264 def stoprecording() pkill raspivid while True: GPIO.wait_for_edge(29,GPIO.FALLING) startrecording() GPIO.wait_for_edge(29,GPIO.RISING) stoprecording()
To make the script run on startup i:
sudo nano /etc/rc.local
(edited the script)
sudo python /home/pi/sample.py
(line above 'Exit 0')
Once i rebooted the raspberry pi i got a 'Invalid Syntax'
Can anyone help me as i really don't know what i am doing?