Last active
May 22, 2018 11:05
-
-
Save uchidama/27d1d3aaad4ff61fe4d957de46415e93 to your computer and use it in GitHub Desktop.
Every time it executes, take a picture with 1 added file name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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