Have a Question?
Table of Contents
< All Topics
Print

202.2 Take photos during solar testing

After setting up ssh to transfer files.

Code:

from picamera2 import Picamera2, Preview
import time
import datetime
import os

picam2 = Picamera2()
camera_config = picam2.create_still_configuration(main={"size": (3280,2464)})
picam2.configure(camera_config)
while True:
    picam2.start()
    time.sleep(2)
    filename = ('/home/bill/images/' + datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + '.jpg')
    picam2.capture_file(filename)
    picam2.stop()
    os.system("scp " + filename + " bill@172.16.40.84:/home/bill/images/SolarTest15/")
    #Record thumbnail image.
    os.system("scp " + filename + " bill@172.16.40.84:/home/bill/images/image.jpg")
    time.sleep (1800)