Skip to content

Instantly share code, notes, and snippets.

@mmoyer2655
Created June 13, 2016 21:40
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mmoyer2655/fdbf1aebe1db516f8c5893ae0cdbed8b to your computer and use it in GitHub Desktop.
Save mmoyer2655/fdbf1aebe1db516f8c5893ae0cdbed8b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import RPi.GPIO as GPIO
import time
import ftplib
import os
GPIO.setmode(GPIO.BCM)
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
sftp.quit()
time.sleep(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment