Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import RPi.GPIO as GPIO
- import time
- import datetime
- import picamera
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
- def get_file_name_pic():
- return datetime.datetime.now().strftime("%Y-%m-%d_%H.%M.%S.jpg")
- with picamera.PiCamera() as camera:
- while True:
- input_state = GPIO.input(21)
- if input_state == False:
- print('Taking Picture...')
- camera.capture('/home/pi/'+get_file_name_pic())
- time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement