trash over HTTP

Dependencies:   C027_Support HTTPClient TrashSensors mbed Crypto

Fork of SLOTrashHTTP by Corey Ford

Collects sensor readings and sends them to https://trash.coreyford.name/

Server code: https://github.com/coyotebush/trash-map

Files at this revision

API Documentation at this revision

Comitter:
coyotebush
Date:
Sun May 31 22:25:25 2015 +0000
Parent:
5:21e76b5af13b
Child:
7:49f2a1277737
Commit message:
Flag first reading

Changed in this revision

TrashSensors.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TrashSensors.lib	Thu May 28 05:13:22 2015 +0000
+++ b/TrashSensors.lib	Sun May 31 22:25:25 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/coyotebush/code/TrashSensors/#3f335fc50cef
+http://developer.mbed.org/users/coyotebush/code/TrashSensors/#9cd59726cc5e
--- a/main.cpp	Thu May 28 05:13:22 2015 +0000
+++ b/main.cpp	Sun May 31 22:25:25 2015 +0000
@@ -46,6 +46,8 @@
 #endif
     HTTPClient http;
     
+    bool first = true;
+    
     int gpsRet;
     char gpsBuf[512];
     double lat = 0, lon = 0;
@@ -90,8 +92,8 @@
         // Combine readings in JSON
         char json[255];
         snprintf(json, 255,
-            "{\"distance\":%0.1f,\"temperature\":%0.1f,\"latitude\":%0.5f,\"longitude\":%0.5f}",
-            distV, tempV, lat, lon);
+            "{\"distance\":%0.1f,\"temperature\":%0.1f,\"latitude\":%0.5f,\"longitude\":%0.5f,\"first\":%d}",
+            distV, tempV, lat, lon, first);
            
         // Compute a MAC (message authentication code) of the value,
         // using our MAC (media access control) address as a key.
@@ -123,6 +125,7 @@
           printf("Error - ret = %d - HTTP return code = %d\r\n", ret, http.getHTTPResponseCode());
         }
         
+        first = false;
         wait_ms(10000);
     }
 }