I decided to add a physical button on it to take photographs.
The idea is simple : A script launched at startup waits for the button and than call the SLP "make_photo" page as if we pressed the icon on the web interface. (Need SLP with such photo icon in the interface, I use version 0.2.3)
To do so, I added a script in /opt/StereoPi/scripts/button.py (which does the job mentionned) and stated it in /opt/StereoPi/run.sh with "./scripts/button.py &".
Here is the script if you want to reproduce:
Code: Select all
#!/usr/bin/env python # Configuration button = 3 # Imports import RPi.GPIO as GPIO from time import sleep from urllib2 import urlopen # Setup GPIO.setmode(GPIO.BCM) GPIO.setup(button, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Wait button loop while True: GPIO.wait_for_edge(button, GPIO.FALLING) print "Shoot!" urlopen('http://localhost/make_photo.php') sleep(0.5)
Edit: the python script should have execution permissions for this way to work (see messages below)