Twitter Library for Arduino Author: NeoCat
Be advised that this library does not tweet directly
from your Arduino. It sends your tweets to a website,
which then tweets it from there.
However, username/password will NOT be sent to
the site by OAuth mechanism. You can invalidate the
OAuth token for this library anytime at http://twitter.com/settings/connections.
1.3.0 2011-12-04: Support IDE 1.0.
1.0.0 2009-04-12: First release.
1.0.1 2009-07-11: Fix a bug on multiple posts.
1.1.0 2010-03-20: Support OAuth and displaying client name ('via Arduino')
1.2.0 2010-10-24: Port EthernetDNS library for IDE 0019 or later
1.2.1 2010-11-13: Add a response output for debugging.
1.2.2 2011-02-05: Modified for ArduinoEthernet Version 1.0b4, and support both IDE 0019(or later) and 0018(or earlier).
1.3.0 2011-12-04: Support IDE 1.0.
Twitter Library is a library for Arduino to tweet on Twitter via the Arduino Ethernet Shield.
It is convenient to making a bot for Twitter which posts messages automatically from various sensors.
Notice: Tweets are sent via a shared server. Please avoid sending more than 1 request per minute not to overload the server.
Download here: Attach:Library-Twitter-1.3.zip
and put the Twitter directory in "~/Documents/Arduino/libraries (Mac) or My Documents\Arduino\libraries\ (Windows)" of Arduino IDE.
If you are using Arduino IDE 0022 or earlier, you also need to install EthernetDNS library 1.0b4 or later, which is available at gkaindl.com. You don't need this with IDE 1.0 or later, because DNS facility is included in EthernetClient library.
The library is automatically complied when you launch the Arduino IDE.
Before tweeting, get a token at http://arduino-tweet.appspot.com/ . This library send a tweet via the site to avoid using up the memory of Arduino by complex OAuth signature stuff.
You can see an example sketch from "File -> Sketchbook -> Example -> Library-Twitter -> SimplePost".
If you are using Arduino IDE 0022 or earlier, please uncomment inclusion of EthernetDNS.h to build the sketch correctly.
To create a new sketch, select from the menubar "Sketch->Import Library->Twitter". Once the library is imported, an '#include <Twitter.h>' line will appear at the top of your Sketch. You need also import Ethernet library and EthernetDNS library in the same way for IDE 0022 or earlier.
You need to create an instance of Twitter class like below:
You need also begin Ethernet library.
Begin posting the specified message to Twitter. If connection to twitter.com is established successfully, this function returns true.
If failed to connect Twitter, returns false. (Check Ethernet is correctly configured.)
Posting is not done yet even it returns true. You should call twitter.checkStatus() periodically or twitter.wait().
Check if the posting request is running. Returns true if it's still running.
You can specify the debug argument to output the response from server for debugging, e.g.
You can omit the debug argument if the output is not required.
Returns the HTTP status code in response from Twitter, e.g. 200 - OK.
Only available after posting the message is done and checkStatus() returns false.
Wait until posting the message is done. Return value of this function is HTTP status code in response from Twitter.
Equivalent for code below:
Notice: Twitter seems to reject repeated tweets with the same contenet (returns error 403).
Notice: Tweets are sent via a shared server. Please avoid sending more than 1 request per minute not to overload the server.
Last Modified: | July 13, 2012, at 10:51 PM |
By: | NeoCat |