Skip to content

Instantly share code, notes, and snippets.

@uchidama
Last active May 22, 2018 11:05
Show Gist options
  • Save uchidama/27d1d3aaad4ff61fe4d957de46415e93 to your computer and use it in GitHub Desktop.
Save uchidama/27d1d3aaad4ff61fe4d957de46415e93 to your computer and use it in GitHub Desktop.
Every time it executes, take a picture with 1 added file name
import subprocess
import os
def take_picture(file_name):
print('raspistill')
args = ['raspistill', '-o', file_name]
res = subprocess.check_call(args)
print(res)
# exist file?
number = 1
while True:
number_padded = '%06d' % number
print(number_padded)
#path = './raspi_photo.py'
#path = './raspi_photo1.py'
path = number_padded + '.jpg'
if os.path.exists(path) == False:
take_picture(path)
break
number += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment