Ball’s First Tweet

Today Ball tweeted!

Screen Shot 2014-03-04 at 19.34.39

 

This was done using the Arduino Twitter library and an el’ cheapo ethernet shield I purchased from Amazon. It uses the SimplePost example from the library but when trying to use this I found an interesting thing: as it is the example doesn’t work!

To begin using the library you have to set up a few things, including getting a key to use their service from this website: http://arduino-tweet.appspot.com/ There you authorise the library as an app so it can post to your account on your behalf. Then you take the tolken they give you, insert it into the sample code and hit play. Sounds easy and too good to be true, and that’s because it is. Sadly after hitting go I was frequently met with ‘Connection Failed’ messages. At first I thought this may be the fault of the ‘el cheapo Ethernet Shield. To test it I set up a Telnet server (check out the ‘chat server’ sample supplied with the Ethernet Shield library). I connected to it through my mac and got a response.

Screen Shot 2014-03-04 at 19.45.08 Screen Shot 2014-03-04 at 19.46.03

 

So, ‘el cheapo Ethernet Shield proves to be a sound purchase! So why no Twitter? To the Googlemobile! A quick search brought me to a post suggesting I should try it with DHCP. Huston we have liftoff! If you want to know why the SimplePost doesn’t work this post holds the answer. It suggests unless you specify a gateway (twice) the gateway for the Ethernet Shield is erroneously set to the IP causing the connection to fail. I tested this theory and found the solution to work! (This method is how the second tweet was sent).

Screen Shot 2014-03-04 at 19.52.31

 

So there you have it, a simple post to Twitter, and why it isn’t quite as simple as you’d hope!