mbed_twitter
Dependencies: EthernetNetIf mbed ID12RFID
Revision 0:3198150a151c, committed 2012-01-26
- Comitter:
- vkarthikr
- Date:
- Thu Jan 26 12:41:36 2012 +0000
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetNetIf.lib Thu Jan 26 12:41:36 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPClient.lib Thu Jan 26 12:41:36 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/HTTPClient/#d0be6af2d1db
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ID12RFID.lib Thu Jan 26 12:41:36 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/ID12RFID/#f04afa911cf5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jan 26 12:41:36 2012 +0000 @@ -0,0 +1,99 @@ +// RFID Tweeter +/* + The basic authentication service for twitter is going down. + To continue using that program, the code has been updated to use http://supertweet.net which acts as an API proxy. + Simply visit the website to setup your twitter account for this API. + See: http://www.supertweet.net/about/documentation +*/ + +#include "mbed.h" +#include "ID12RFID.h" +#include "EthernetNetIf.h" +#include "HTTPClient.h" + +#define TWITTER_USER "mbed_cloud" +#define TWITTER_PASSWORD "password" + +#define ACTIVE 1 +#define INACTIVE 0 + + + +const char* names_list[2] = {"Prasanna", "Ganesh"}; + +EthernetNetIf ethernet; +HTTPClient twitter; + +DigitalIn RFID(p11); +DigitalOut PersonDetected(LED1); +DigitalOut tweet_ok(LED4); + +int main() +{ + + int GoAhead = 0,i=0,count =0; + char text[5]; + ethernet.setup(); + twitter.basicAuth(TWITTER_USER, TWITTER_PASSWORD); + + while(true) + { + + GoAhead = 0; + if(ACTIVE == RFID) + { + // wait(1); + if(ACTIVE == RFID) + { + GoAhead = 1; + } + else + { + GoAhead = 0; + } + } + + if(1 == GoAhead) + { + + HTTPMap msg; + PersonDetected = 1; + snprintf(text, sizeof(text), " %d", count++); + msg["status"] = text; + + ///////Dont Change above here + + + + msg["status"] += " Hi friend, "; + msg["status"] += " Final Testing "; + // msg["status"] += "For you all "; + msg["status"] += names_list[i]; + msg["status"] += " arrived"; + + printf("\n testing in computer"); + + + + ///////Dont Change from here + HTTPResult r = twitter.post("http://api.supertweet.net/1/statuses/update.xml", msg, NULL); + tweet_ok = !r; + if(0 == r) + { + wait(2); + } + + + i++; + if(i>1) + { + i = 0; + } + } + // wait(3); + tweet_ok = 0; + PersonDetected = 0; + // wait(2); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jan 26 12:41:36 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da