The Twitter Button is Back in Business!
(Expect updated code soon)
Note: Twitter changed its authentication system to reject basic http auth…
This might does work: http://www.arduino.cc/playground/Code/TwitterLibrary
The “Twitter Button” project's goal is to use a big red HAL9000 button to indicate via twitter that a keyholder is present at NSL The project has since been expanded to include an RFID reader to identify keyholders in addition to the button.
Active Use! The button is up and mounted next to the door! Current twitter button status can be viewed on the When Are You There page :)
Completed:
In Progress:
Current Issues:
Future Plans:
<code>
- include <Ethernet.h>
byte mactwitter_button = { 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed };
byte iptwitter_button = { 10, 0, 5, 247 };\t\t\t this is the ip within my lan
byte gatewaytwitter_button = { 10, 0, 0, 1 };\t\t\t neccessary to get access to the internet via your router
byte subnettwitter_button = { 255, 0, 0, 0 };
byte servertwitter_button = { 128, 121, 146, 100 };\t\t Twitter's ip
Client client(server, 80);
void setup()
{
<code>
Ethernet.begin(mac, ip, gateway, subnet);
Serial.begin(9600);
delay(1000);
Serial.println(`connecting…`);
if (client.connect()) {
Serial.println(`connected`);
client.println(`POST http://twitter.com/statuses/update.json HTTP/1.1`);
client.println(`Host: twitter.com`);
client.println(`Authorization: Basic XXXXXXXXXXXXX`); the string of ###s after `Basic` is the base64_encoded Text of username:password of your twitter account</code>
\t\t\t\t\t\t\t\t\t\t\t\t you can do the encoding at this site: http://www.functions-online.com/en/base64_encode.html
<code>
client.println(`Content-type: application/x-www-form-urlencoded`);
client.println(`Content-length: 28`);\t\t\t\t\t this is the length of the text `Yahoo, im twittering!`
client.println(`Connection: Close`);
client.println();
client.print(`status=Yahoo, im twittering!`);
} else {
Serial.println(`connection failed`);
}</code>
}
void loop()
{
<code>
if (client.available()) {
char c = client.read();
Serial.print©;
}
if (!client.connected()) {
Serial.println();
Serial.println(`disconnecting.`);
client.stop();
for(;;)</code>
\t;
<code>
}</code>
}
</code>
Any inquiries/suggestions should be told/sent/given/yelled to Davo in person, via the nsl list, or via IRC… :)