GSMA version

Dependencies:   FXOS8700CQ mbed

Fork of AvnetATT_shape_hackathon by Rick McConney

Revision:
20:27a4f27254d0
Parent:
19:f89baed3bd6f
Child:
21:d0038d14ee7c
--- a/main.cpp	Wed Jul 13 17:35:14 2016 +0000
+++ b/main.cpp	Wed Jul 13 17:57:14 2016 +0000
@@ -437,6 +437,9 @@
     
     void hts221_init(void);
 
+    // Set LED to RED until init finishes
+    SetLedColor(0x1);
+
     pc.printf(BLU "Hello World from AT&T Shape!\r\n\n\r");
     pc.printf(GRN "Initialize the HTS221\n\r");
 
@@ -449,7 +452,6 @@
     printf("Temp  is: %0.2f F \n\r",CTOF(hts221.readTemperature()));
     printf("Humid is: %02d %%\n\r",hts221.readHumidity());
     
-    SetLedColor(0); //Off
     sensors_init();
     read_sensors();
 
@@ -472,8 +474,12 @@
     OneMsTicker.attach(OneMsFunction, 0.001f) ;
     iTimer1Interval_ms = 5000; //5 seconds
 
+    // Set LED BLUE for partial init
+    SetLedColor(0x4);
+
     // Send and receive data perpetually
     while(1) {
+        static unsigned ledOnce = 0;
         if  (bTimerExpiredFlag)
         {
             bTimerExpiredFlag = false;
@@ -486,6 +492,15 @@
             printf(BLU "Sending to modem : %s" DEF "\n", modem_string); 
             sockwrite_mdm(modem_string);
             sockread_mdm(&MySocketData, 1024, 20);
+            
+            // If any non-zero response from server, make it GREEN one-time
+            //  then the actual FLOW responses will set the color.
+            if ((!ledOnce) && (MySocketData.length() > 0))
+            {
+                ledOnce = 1;
+                SetLedColor(0x2);
+            }
+            
             printf(BLU "Read back : %s" DEF "\n", &MySocketData[0]);
             char * myJsonResponse;
             if (extract_JSON(&MySocketData[0], &myJsonResponse[0]))