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|http://www.arduino.cc/playground/Code/TwitterLibrary]] ===== Summary ===== 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. ===== Status ===== **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 :) ===== Objectives ===== Completed: * Light up button while "NSL is open" * Tweet status * Status change by button-press * Read and Identify RFID card * Status change by RFID read * Specific status change based on RFID card used * Twitter session [[no|longer]] expires after 10 min. * Twitter wont let you "retweet" past posts... (need to make each post [[is|now]] unique) In Progress: * Configure for keyholder RFID cards... So far I have a handful of cards set up, let me know if I've missed you... * Package into Box * Sleep Current Issues: * Twitter has a limit on posts per hour... not nice for testing * Fit everything into the box, need to play more tetris. (I think that everything fits now) * Make holes in box for power/ethernet/usb/program mode button Future Plans: * Authenticate RFID with a Python app on server. ===== Code - Basic Concept ===== '' - include byte mac[[]] = { 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed }; byte ip[[]] = { 10, 0, 5, 247 };\t\t\t // this is the ip within my lan byte gateway[[]] = { 10, 0, 0, 1 };\t\t\t// neccessary to get access to the internet via your router byte subnet[[]] = { 255, 0, 0, 0 }; byte server[[]] = { 128, 121, 146, 100 };\t\t // Twitter's ip Client client(server, 80); void setup() { 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 \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 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`); } } void loop() { if (client.available()) { char c = client.read(); Serial.print(c); } if (!client.connected()) { Serial.println(); Serial.println(`disconnecting.`); client.stop(); for(;;) \t; } } '' ===== Contact ===== Any inquiries/suggestions should be told/sent/given/yelled to [[Davo]] in person, via the nsl list, or via IRC... :)