Skip to content

Instantly share code, notes, and snippets.

@codebrane
Created August 3, 2013 10:03
Show Gist options
  • Save codebrane/6145940 to your computer and use it in GitHub Desktop.
Save codebrane/6145940 to your computer and use it in GitHub Desktop.
Taking a picture with the Raspberry Pi camera and uploading it to Dropbox
require 'dropbox_sdk'
file = File.open('access_token', "rb")
access_token = file.read
client = DropboxClient.new(access_token)
puts "taking picture..."
system('raspistill -o camera_image.jpg')
puts "uploading..."
file = open('camera_image.jpg')
response = client.put_file('/latest.jpg', file)
puts "uploaded:", response.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment