Dependencies: EthernetNetIf mbed
Revision 0:96e3b1c49f9b, committed 2010-06-14
- Comitter:
- donatien
- Date:
- Mon Jun 14 10:29:54 2010 +0000
- Child:
- 1:7050426c5b43
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetNetIf.lib Mon Jun 14 10:29:54 2010 +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 Mon Jun 14 10:29:54 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/HTTPClient/#d97a4fc01c86
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TwitterExample.cpp Mon Jun 14 10:29:54 2010 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" +#include "EthernetNetIf.h" +#include "HTTPClient.h" + +EthernetNetIf eth; + +int main() { + + printf("Init\n"); + + printf("\r\nSetting up...\r\n"); + EthernetErr ethErr = eth.setup(); + if(ethErr) + { + printf("Error %d in setup.\n", ethErr); + return -1; + } + printf("\r\nSetup OK\r\n"); + + HTTPClient twitter; + + HTTPMap msg; + msg["status"] = "I am tweeting from my mbed!"; //A good example of Key/Value pair use with Web APIs + + twitter.basicAuth("myuser", "mypass"); //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://twitter.com/statuses/update.xml", msg, NULL); + if( r == HTTP_OK ) + { + printf("Tweet sent with success!\n"); + } + else + { + printf("Problem during tweeting, return code %d\n", r); + } + + return 0; + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Jun 14 10:29:54 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/029aa53d7323