GPS Tweeter program that tweets the device's GPS location every 5 minutes.
Dependencies: EthernetNetIf HTTPClient mbed
Fork of TwitterExample by
Revision 6:a5d8918748fa, committed 2013-10-16
- Comitter:
- 4180skrw
- Date:
- Wed Oct 16 20:42:20 2013 +0000
- Parent:
- 5:22fb0d9a5de2
- Commit message:
- fixed
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 22fb0d9a5de2 -r a5d8918748fa main.cpp --- a/main.cpp Wed Oct 16 20:40:55 2013 +0000 +++ b/main.cpp Wed Oct 16 20:42:20 2013 +0000 @@ -31,36 +31,24 @@ if(gps.sample()) { printf("I'm at %f, %f\n\r", gps.longitude, gps.latitude); sprintf(buff,"I'm at %f, %f", gps.longitude, gps.latitude); - msg["status"] = buff; - twitter.basicAuth("username", "password"); //We use basic authentication, replace with you account's parameters - - //No need to retieve data sent back by the server - HTTPResult r = twitter.post("http://api.supertweet.net/1.1/statuses/update.json", msg, NULL); - if( r == HTTP_OK ) - { - printf("Tweet sent with success!\n"); - } - else - { - printf("Problem during tweeting, return code %d\n", r); - } - } else { printf("Oh Dear! No lock :(\n\r"); sprintf(buff,"Location Unknown"); - msg["status"] = buff; - twitter.basicAuth("username", "password"); //We use basic authentication, replace with you account's parameters - - //No need to retieve data sent back by the server - HTTPResult r = twitter.post("http://api.supertweet.net/1.1/statuses/update.json", msg, NULL); - if( r == HTTP_OK ) - { - printf("Tweet sent with success!\n"); } - else - { - printf("Problem during tweeting, return code %d\n", r); - } + } + + msg["status"] = buff; + twitter.basicAuth("username", "password"); //We use basic authentication, replace with you account's parameters + + //No need to retieve data sent back by the server + HTTPResult r = twitter.post("http://api.supertweet.net/1.1/statuses/update.json", msg, NULL); + if( r == HTTP_OK ) + { + printf("Tweet sent with success!\n"); + } + else + { + printf("Problem during tweeting, return code %d\n", r); } wait(60*5); //Repeat ever 5 minutes