Install software:
opkg update #updates the available packages list opkg install python-openssl #adds ssl support to python opkg install distribute #it contains the easy_install easy_install twython
nano /mnt/sda1/yuntwitter.py
#!/usr/bin/python from twython import Twython import sys messagetotwitter=sys.argv[1] APP_KEY='Your Twitter APP_KEY' APP_SECRET='Your Twitter APP_SECRET' OAUTH_TOKEN='Your Twitter OAUTH_TOKEN' OAUTH_TOKEN_SECRET='Your Twitter OAUTH_TOKEN_SECRET' twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) twitter.update_status(status=messagetotwitter)
chmod 755 /mnt/sda1/yuntwitter.py
Test tweets:
/mnt/sda1/yuntwitter.py "I'm tweeting from Arduino!"
ATmega32u4 Code:
#include <Process.h> void setup() { Bridge.begin(); // Initialize Bridge } void loop() { Process p; p.begin("/mnt/sda1/yuntwitter.py"); p.addParameter("I'm tweeting from Arduino Yun!"); p.run(); while(1){}; //run once }
Comments powered by CComment