element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Social Xmas Tree 2
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 390 subscribers
  • Views 219 views
  • Users 0 members are here
  • interactive_objects
  • iot_holidaylights
  • internet_of_things
  • arduino
Related

Social Xmas Tree 2

max.dbt
max.dbt over 10 years ago

Hi,

it took me a while to get the project working. I planned to make a Facebook profile to post pictures from Arduino Yun and use likes and comments to light up the leds. However Facebook has new policies regarding applications, now it's necessary to pass an approval process that takes a week and they didn't approved mine (it should be a web app and not an object) . I used the Temboo apis but the problems is that the images posted are private, the support confirmed me the problems with the new Fb policies. So I used a workaround posting on Twitter and linking the account to Facebook https://www.facebook.com/profile.php?id=100008703930280.

I attach the code I used on the Yun. It's a python script based on the example of Arduino Yún social photo camera | MIKAMAYHEM used to upload the pictur shooted using fswebcam.

 

 

# coding=utf-8


# Copyright (C) 2014  Stefano Guglielmetti


# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.


# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.


# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


import base64
import sys
from temboo.core.session import TembooSession
from temboo.Library.Twitter.Tweets import UpdateWithMedia


print str(sys.argv[1])


with open(str(sys.argv[1]), "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())


# Create a session with your Temboo account details
session = TembooSession("account", "myFirstApp", "key")


# Instantiate the Choreo
updateWithMediaChoreo = UpdateWithMedia(session)


# Get an InputSet object for the Choreo
updateWithMediaInputs = updateWithMediaChoreo.new_input_set()


#inputs
updateWithMediaInputs.set_MediaContent(encoded_string)
updateWithMediaInputs.set_AccessToken("mytoken")
updateWithMediaInputs.set_AccessTokenSecret("mysecret")
updateWithMediaInputs.set_Latitude("41.9000")
updateWithMediaInputs.set_ConsumerSecret("consumer secret")
updateWithMediaInputs.set_Longitude("12.5000")
updateWithMediaInputs.set_StatusUpdate("Foto scattata alle " + print (time.strftime("%H:%M:%S")) + " Buone Feste!")
updateWithMediaInputs.set_ConsumerKey("consumer key")
updateWithMediaInputs.set_DisplayCoordinates("true")


# Execute the Choreo
updateWithMediaResults = updateWithMediaChoreo.execute_with_results(updateWithMediaInputs)


# Print the Choreo outputs
print("Response: " + updateWithMediaResults.get_Response())
print("Limit: " + updateWithMediaResults.get_Limit())
print("Remaining: " + updateWithMediaResults.get_Remaining())
print("Reset: " + updateWithMediaResults.get_Reset())

 

As I have some troubles reading likes from Facebook now the leds light up con confirm that the picture was uploaded.

 

Here is the sketch, the picture is shoot when two people hold a branch of the tree and then touch each other.

#include <Process.h>
const int buttonPin = 10; // pin for the pushbutton 
const int ledPin =  13; // pin for the status led
String path = "/mnt/sda1/";
String file = "/www/sd/fotop.png"; // path of the images and script file 
String messaggio = "";
void setup() {
  // put your setup code here, to run once:
 Bridge.begin(); // The bridge library is used to run processes on the linux side
    pinMode(ledPin, OUTPUT);      
    pinMode(buttonPin, INPUT); 
    Serial.begin(9600); // Serial port for debugging
    //filename = "test";
}


void loop() {
  // put your main code here, to run repeatedly:
int btn = digitalRead(10);
int tocco = analogRead(A0);
if(tocco < 800){
// Serial.println("contatto"); 
 digitalWrite(13,HIGH);
}else{
digitalWrite(13,LOW);
}
Serial.println(tocco);
delay(5);
if(btn == HIGH){
  Serial.println("premuto");
Process p;  
messaggio = "Foto scattata";


p.runShellCommand("fswebcam -c ~/.fswebcam.conf"); //let's take the picture
while(p.running());  //waits till the picture is saved
Serial.println(messaggio); 
delay(5000);
p.runShellCommand("python " + path + "sendphoto_tw.py " + file ); //sends the picture to facebook 
while(p.running()); 
Serial.println("picture sent"); //last debug message    
}
}

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube