Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetNetIf OAuth4Tw mbed HTTPClient
main.cpp
00001 #include <string.h> 00002 #include "mbed.h" 00003 #include "EthernetNetIf.h" 00004 #include "OAuth4Tw.h" 00005 00006 DigitalOut myled(LED1); 00007 EthernetNetIf eth; 00008 00009 int main() { 00010 EthernetErr ethErr = eth.setup(); 00011 if (ethErr) { 00012 printf("Error %d in setup.\n", ethErr); 00013 return -1; 00014 } 00015 00016 OAuth4Tw oa4t("XXXXXXXXXXXXXXXXXXXXXX", // Consumer key 00017 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", // Consumer secret 00018 "000000000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // Access token 00019 "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // Access token secret 00020 std::string uri = "http://api.twitter.com/statuses/update.xml"; 00021 uri += "?status="; 00022 uri += OAuth4Tw::url_escape("Hello World!"); 00023 std::string postarg; 00024 std::string postres = oa4t.post(uri.c_str(), postarg); 00025 printf("postres: %s\n", postres.c_str()); 00026 00027 while (1) { 00028 myled = 1; 00029 wait(0.2); 00030 myled = 0; 00031 wait(0.2); 00032 } 00033 }
Generated on Tue Aug 2 2022 07:27:56 by
1.7.2