Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python3
import RPi.GPIO as GPIO
import time
import ftplib
import os
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(18)
if input_state == False:
os.system ("fswebcam --delay 1.5 -r 1920x1080 -S 20 --scale 960x540 --rotate 270 inourfri$
sftp = ftplib.FTP('HOST','USER','PASSWORD') # Connect
fp = open('inourfridge.jpg') # file to send
sftp.storbinary('STOR inourfridge.jpg', fp) # Send the file
fp.close() # Close file and FTP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment