Rev 1.0 4/26/2016 Paul Jaeger - Multitech, Brian Huey - Sprint Changed post interval to 2000ms added temp, analoguv and pressure to http post added alias: TEMP ANALOG-UV PRESSURE concatenated http post, to post all within the same routine and check for error after the post confirmed that data is published to Exosite

Dependencies:   MbedJSONValue mbed mtsas

Fork of UUU_MultiTech_Dragonfly_Sprint by Paul Jaeger

Revision:
3:f6bceb9e5e1a
Parent:
2:955a63247721
Child:
4:730b61258422
--- a/main.cpp	Thu Sep 24 19:19:11 2015 +0000
+++ b/main.cpp	Thu Sep 24 19:35:46 2015 +0000
@@ -31,6 +31,8 @@
  *   - Connect the Grove button to the D8 socket on the Base Shield
  *   - Connect the Grove moisture sensor to the A0 socket on the Base
  *     Shield
+ *   - Make sure the reference voltage selector switch (next to the A0
+ *     socket) is switched to 5V so you get accurate analog readings
  *   - Stack the MEMs board on top of the Base Shield
  *   - Plug in the power cable
  *   - Plug a micro USB cable into the port below and slightly to the
@@ -84,7 +86,7 @@
 // misc variables
 static char wall_of_dash[] = "--------------------------------------------------";
 bool radio_ok = false;
-static int thp_interval_ms = 2000;
+static int thpm_interval_ms = 2000;
 static int motion_interval_ms = 250;
 static int print_interval_ms = 5000;
 int debug_baud = 115200;
@@ -114,11 +116,11 @@
         
     button.fall(&button_irq);
         
-    Timer thp_timer;
+    Timer thpm_timer;
     Timer motion_timer;
     Timer print_timer;
     
-    thp_timer.start();
+    thpm_timer.start();
     motion_timer.start();
     print_timer.start();
     
@@ -130,11 +132,12 @@
             motion_timer.reset();
         }
         
-        if (thp_timer.read_ms() > thp_interval_ms) {
+        if (thpm_timer.read_ms() > thpm_interval_ms) {
             read_temperature();
             read_humidity();
             read_pressure();
-            thp_timer.reset();
+            read_moisture();
+            thpm_timer.reset();
         }
         
         if (print_timer.read_ms() > print_interval_ms) {
@@ -235,7 +238,7 @@
 }
 
 void read_moisture() {
-    moisture_percent = moisture_sensor;
+    moisture_percent = moisture_sensor * 100.0;
 }
 
 void read_magnetometer() {