M2X demo using the Freescale FRDM-KL46Z and Multitech Socketmodem MTSMS-H5

Dependencies:   M2XStreamClient MMA8451Q SocketModem jsonlite mbed

Fork of MTS_M2x_Example by Multi-Hackers

Revision:
6:0dbcf434679b
Parent:
5:d4a4e2577be3
Parent:
3:d24e8bec5610
Child:
8:54f32950dab2
--- a/main.cpp	Sun Jan 05 07:00:38 2014 +0000
+++ b/main.cpp	Sun Jan 05 07:03:49 2014 +0000
@@ -4,19 +4,21 @@
 
 using namespace mts;
 
-const char key[] = "";
-const char feed[] = "";
-const char stream[] = "amb-temp";
+const char key[] = "";  // enter your m2x user account master key
+const char feed[] = ""; // enter your blueprint feed id
+const char stream[] = "amb-temp";   // Create a stream name
 
 // set to 1 for cellular shield board
 // set to 0 for wifi shield board
-#define CELL_SHIELD 0
+#define CELL_SHIELD 1
 
+// ssid and phrase for wifi
 std::string ssid = "belkin54g";
 std::string phrase = "hackathon";
 Wifi::SecurityType security_type = Wifi::WPA;
 
-int main() {
+int main()
+{
 #if CELL_SHIELD
     MTSSerialFlowControl* serial = new MTSSerialFlowControl(PTD3, PTD2, PTA12, PTC8);
     serial->baud(115200);
@@ -27,7 +29,7 @@
     int max_tries = 5;
     int i;
     std::string apn = "wap.cingular";
-    
+
     i = 0;
     while (i++ < max_tries) {
         if (cell->getRegistration() == Cellular::REGISTERED) {
@@ -39,7 +41,7 @@
             wait(3);
         }
     }
-    
+
     printf("signal strength: %d\n\r", cell->getSignalStrength());
 
     i = 0;
@@ -54,7 +56,7 @@
             wait(1);
         }
     }
-    
+
     i = 0;
     printf("bringing up PPP link\n\r");
     while (i++ < max_tries) {
@@ -84,7 +86,7 @@
     printf("Connect: %s\n\r", wifi->connect() ? "Success" : "Failure");
     printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False");
 #endif
-    
+
     /* send some data */
     Client client;
     M2XStreamClient m2xClient(&client, key);