trash over HTTP
Dependencies: C027_Support HTTPClient TrashSensors mbed Crypto
Fork of SLOTrashHTTP by
Collects sensor readings and sends them to https://trash.coreyford.name/
Server code: https://github.com/coyotebush/trash-map
Diff: main.cpp
- Revision:
- 6:43ac8ef67a03
- Parent:
- 5:21e76b5af13b
- Child:
- 7:49f2a1277737
diff -r 21e76b5af13b -r 43ac8ef67a03 main.cpp --- 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); } }