Example program streaming accelerometer data to a websocket server over a Sprint Mobile Broadband connection

Dependencies:   MMA7660 SprintUSBModem WebSocketClient mbed-rtos mbed

Revision:
2:9304861e65d6
Parent:
0:0389bce1c74d
Child:
4:c1ce97cb8d74
--- a/main.cpp	Thu Sep 27 09:01:06 2012 +0000
+++ b/main.cpp	Wed Oct 10 08:34:59 2012 +0000
@@ -16,21 +16,21 @@
     int ret = modem.connect();
     if(ret)
     {
-      printf("Could not connect\n");
+      printf("Could not connect\r\n");
       return;
     }
     
     //GET data
-    printf("Trying to fetch page...\n");
+    printf("Trying to fetch page...\r\n");
     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
@@ -38,21 +38,27 @@
     HTTPText text(str, 512);
     map.put("Hello", "World");
     map.put("test", "1234");
-    printf("Trying to post data...\n");
+    printf("Trying to post data...\r\n");
     ret = http.post("http://httpbin.org/post", map, &text);
     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());
     }
     
+    printf("Disconnecting\r\n");
+    
     modem.disconnect(); 
     
+    printf("Disconnected\r\n");
+    
     modem.power(false); 
+    
+    printf("Powered off\n");
 
     while(1) {
     }