I have rpi zero with camera module. I would like ro take pictures by presing a switch.
I copied a python script for this purpose. I added another switch to exit the script..
The script uses pin 18 to take a photo and pin 17 to exit the script. The script takes photos using raspistill.
Here is the script:
import RPi.GPIO as GPIO
from time import sleep
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
input = 1
input_state = GPIO.input(18)
if input_state == False:
os.system(" sudo raspistill -q 100 -ev 2 -n -t 300 -o imm%04d.jpg")
input = GPIO.input(17)
It works but it saves only one filename.jpg. I think that is because at each shot raspistill counts the %04d number from the beginning (i.e. imm0001.jpg).
I read raspistill documentation but I could not find any suggestions. It is not a timelapse but I take pictures at my own pace pressing a switch.
Could someone suggest a way of saving the images with progressive numbering at each new shot using raspistill?