Please forgive me as I am not a programmer, I cannot code and I have never learned to code. However, I need some code to take a photo with a raspberry pi camera module V2 every x minutes and upload it to an ftp server. This way I can check on a chemical reaction that runs overnight in a lab (I’m a chemist). I already spent 8 hours trying to get the #(@ working but all I get are syntax errors or blinking cursors.
I can make jpg’s from command line, but they are only 20kb and 800×600. I need them 3280 * 2464 (the native camera resolution). I think I have a command for that in my code, but it doesn’t work.
How do I fix this? This is my code so far:
`
from picamera2 import Picamera2, Preview
from datetime import datetime
import time
from ftplib import FTP
picam2 = Picamera2()
camera_config = picam2.create_preview_configuration()
picam2.configure(camera_config)
ftp = FTP('server')
ftp.login('user','pass')
pics_taken = 0
max_pics = 1
while pics_taken <= max_pics:
picam2.start()
time.sleep(2)
picam2.resolution = (3280, 2464)
current_datetime = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
` filename = "base" + current_datetime + ".jpg"
picam2.capture_file(filename)
pics_taken += 1
time.sleep(3)
file = open(filename,'rb') # file to send
ftp.retrlines('LIST')
file.close() # close file and FTP
ftp.quit()`
I tried to add picam2.resolution command, but it does not help.
nielsgeode is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.