cc3000 twitter demo, uses supertweet services. Set your account there and then fill a user and a secret inside the demo.
Dependencies: HTTPClient NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed
Uses http://www.supertweet.net/, please register there and fill user and secret inside the application.
Diff: main.cpp
- Revision:
- 1:f35cc7e300f7
- Parent:
- 0:5aa9273cb749
- Child:
- 2:0ceaeaa53a81
diff -r 5aa9273cb749 -r f35cc7e300f7 main.cpp
--- a/main.cpp Mon Oct 07 16:33:28 2013 +0000
+++ b/main.cpp Mon Oct 07 18:42:23 2013 +0200
@@ -106,7 +106,7 @@
}
/**
- * \brief Websocket demo
+ * \brief Twitter demo
* \param none
* \return int
*/
@@ -115,7 +115,7 @@
pc.baud(115200);
wifi.start(0);
- printf("cc3000 Websocket demo. \r\n");
+ printf("cc3000 twitter demo. \r\n");
print_cc3000_info();
printf("Attempting SSID Connection. \r\n");
@@ -154,19 +154,19 @@
HTTPMap map;
HTTPText inText(str, 512);
map.put("status", "I am tweeting from mbed with cc3000.");
-
- printf("\nTrying to post data...\n");
+
+ printf("\r\nTrying to post data...\r\n");
twitter.basicAuth("username", "secret"); //We use basic authentication, replace with you account's parameters
int ret = twitter.post("http://api.supertweet.net/1.1/statuses/update.json", map, &inText);
if (!ret)
{
- printf("Executed POST successfully - read %d characters\n", strlen(str));
- printf("Result: %s\n", str);
+ printf("Executed POST successfully - read %d characters\r\n", strlen(str));
+ printf("Result: %s \r\n", str);
}
else
{
- printf("Error - ret = %d - HTTP return code = %d\n", ret, twitter.getHTTPResponseCode());
+ printf("Error - ret = %d - HTTP return code = %d \r\n", ret, twitter.getHTTPResponseCode());
}
-
- printf("Demo completed. \r\n");
+
+ printf("Twitter demo completed.\r\n");
}