Álvaro Hurtado / Mbed 2 deprecated TweetRFID

Dependencies:   EthernetNetIf mbed ID12RFID

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // RFID Tweeter
00002 /*
00003   Update: 21-06-2010
00004   The basic authentication service for twitter is going down.
00005   To continue using that program, the code has been updated to use http://supertweet.net which acts as an API proxy.
00006   Simply visit the website to setup your twitter account for this API.
00007   See: http://www.supertweet.net/about/documentation
00008 */
00009 
00010 #include "mbed.h"
00011 //#include "ID12RFID.h"
00012 #include "EthernetNetIf.h"
00013 #include "HTTPClient.h"
00014 
00015 #define TWITTER_USER "cilabnerds"
00016 #define TWITTER_PASSWORD "********"
00017 
00018 #define IDS_COUNT 3
00019 //const int ids_list[IDS_COUNT] = {89481809, 89481810, 89481811};
00020 //const char* names_list[IDS_COUNT] = {"Donatien", "Simon", "Dan"};
00021 
00022 EthernetNetIf ethernet;
00023 HTTPClient twitter;
00024 
00025 //ID12RFID rfid(p14);
00026 DigitalOut led1(LED1);
00027 DigitalOut led2(LED2);
00028 DigitalOut led3(LED3);
00029 DigitalOut led4(LED4);
00030 
00031 int main() {
00032     led1 = 1;
00033     if (ethernet.setup() == ETH_OK)
00034         led2 = 1;
00035     else{
00036         led1 = 0;
00037     }
00038     wait(2);
00039     
00040     twitter.basicAuth(TWITTER_USER, TWITTER_PASSWORD);
00041     led3 = 1;
00042     
00043     HTTPMap msg;
00044     msg["status"] = "Alvaro esta twitteando desde una plaquita mbed NXP LPC1768. Experimentos desde \@cilabtwitt.";
00045     HTTPResult r = twitter.post("http://api.supertweet.net/1/statuses/update.xml", msg, NULL);
00046     
00047     if(r == HTTP_OK)
00048         led4 = 1;
00049     else{
00050         led1 = 0;
00051         led2 = 0;
00052         led3 = 0;
00053    }
00054 }