This program simply connects to a HTS221 I2C device to read Temperature

Dependencies:   FXOS8700CQ mbed

Files at this revision

API Documentation at this revision

Comitter:
fkellermavnet
Date:
Wed Jul 13 20:05:21 2016 +0000
Parent:
22:41e6c417ace1
Child:
26:8d6e7e7cdcae
Commit message:
Only do 1 socket open (before was doing open -> write -> read -> close. So now do 1 open then write -> read -> write -> read ...

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jul 13 19:39:56 2016 +0000
+++ b/main.cpp	Wed Jul 13 20:05:21 2016 +0000
@@ -475,6 +475,8 @@
     //Create a 1ms timer tick function:
     OneMsTicker.attach(OneMsFunction, 0.001f) ;
     iTimer1Interval_ms = 5000; //5 seconds
+    
+    sockopen_mdm();
 
     // Set LED BLUE for partial init
     SetLedColor(0x4);
@@ -488,7 +490,7 @@
             sprintf(SENSOR_DATA.Temperature, "%0.2f", CTOF(hts221.readTemperature()));
             sprintf(SENSOR_DATA.Humidity, "%02d", hts221.readHumidity());
             read_sensors(); //read available external sensors from a PMOD and the on-board motion sensor
-            sockopen_mdm();
+            //sockopen_mdm();
             char modem_string[512];
             GenerateModemString(&modem_string[0]);
             printf(BLU "Sending to modem : %s" DEF "\n", modem_string); 
@@ -515,7 +517,7 @@
                 printf(RED "JSON : %s" DEF "\n", &myJsonResponse[0]); //most likely an incomplete JSON string
                 parse_JSON(&myJsonResponse[0]); //This is risky, as the string may be corrupted
             }
-            sockclose_mdm();
+            // sockclose_mdm();
         } //bTimerExpiredFlag
     } //forever loop
 }