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: MMA8451Q NVIC_set_all_priorities TSI cc3000_hostdriver_mbedsocket mbed
Fork of AxedaGo-Freescale by
Revision 1:58cd57bddd3a, committed 2013-10-07
- Comitter:
- Kojto
- Date:
- Mon Oct 07 17:23:47 2013 +0200
- Parent:
- 0:fe1445e57b7d
- Child:
- 2:bc6c789cac58
- Commit message:
- \r added to printf
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 07 15:19:40 2013 +0000
+++ b/main.cpp Mon Oct 07 17:23:47 2013 +0200
@@ -70,11 +70,11 @@
* \return none
*/
void connect_to_ssid(char *ssid, char *key, unsigned char sec_mode) {
- printf("Connecting to SSID: %s. Timeout is 10s.\n",ssid);
+ printf("Connecting to SSID: %s. Timeout is 10s. \r\n",ssid);
if (wifi.connect_to_AP((uint8_t *)ssid, (uint8_t *)key, sec_mode) == true) {
- printf(" Connected\n");
+ printf(" Connected \r\n");
} else {
- printf(" Connection timed-out (error). Please restart.\n");
+ printf(" Connection timed-out (error). Please restart. \r\n");
while(1);
}
}
@@ -152,64 +152,64 @@
printf("DHCP assigned IP Address = %d.%d.%d.%d \r\n", ipinfo2.aucIP[3], ipinfo2.aucIP[2], ipinfo2.aucIP[1], ipinfo2.aucIP[0]);
//GET data
- printf("\nTrying to fetch page...\n");
+ printf("\r\nTrying to fetch page... \r\n");
int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128);
if (!ret)
{
- printf("Page fetched successfully - read %d characters\n", strlen(str));
- printf("Result: %s\n", str);
+ printf("Page fetched 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, http.getHTTPResponseCode());
+ printf("Error - ret = %d - HTTP return code = %d \r\n", ret, http.getHTTPResponseCode());
}
-
+
//POST data
HTTPMap map;
HTTPText inText(str, 512);
map.put("Hello", "World");
map.put("test", "1234");
- printf("\nTrying to post data...\n");
+ printf(" \r\nTrying to post data... \r\n");
ret = http.post("http://httpbin.org/post", 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, http.getHTTPResponseCode());
+ printf("Error - ret = %d - HTTP return code = %d \r\n", ret, http.getHTTPResponseCode());
}
-
+
//PUT data
strcpy(str, "This is a PUT test!");
HTTPText outText(str);
//HTTPText inText(str, 512);
- printf("\nTrying to put resource...\n");
+ printf(" \r\nTrying to put resource... \r\n");
ret = http.put("http://httpbin.org/put", outText, &inText);
if (!ret)
{
- printf("Executed PUT successfully - read %d characters\n", strlen(str));
- printf("Result: %s\n", str);
+ printf("Executed PUT 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, http.getHTTPResponseCode());
+ printf("Error - ret = %d - HTTP return code = %d \r\n", ret, http.getHTTPResponseCode());
}
-
+
//DELETE data
//HTTPText inText(str, 512);
- printf("\nTrying to delete resource...\n");
+ printf(" \r\nTrying to delete resource... \r\n");
ret = http.del("http://httpbin.org/delete", &inText);
if (!ret)
{
- printf("Executed DELETE successfully - read %d characters\n", strlen(str));
- printf("Result: %s\n", str);
+ printf("Executed DELETE 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, http.getHTTPResponseCode());
+ printf("Error - ret = %d - HTTP return code = %d \r\n", ret, http.getHTTPResponseCode());
}
-
+
printf("Demo completed. \r\n");
}
