m3Dpi robot, based on the Pololu 3pi and m3pi. m3Dpi has multiple distance sensors, gyroscope, compass and accelerometer sensor to be fully aware of its environment. With the addition of xbee or nrf24n01 module it has wireless communication capabilities.

Dependencies:   m3Dpi mbed-rtos mbed MbedJSONValue

Revision:
8:5c0833506d67
Parent:
7:9068fc754a0b
--- a/lib/jsonReporter.cpp	Thu Dec 03 17:53:04 2015 +0000
+++ b/lib/jsonReporter.cpp	Fri Dec 11 10:40:40 2015 +0000
@@ -19,10 +19,9 @@
 
 void JsonReporter::time(time_t seconds)
 {
-    char buffer[32];
-    std::strftime(buffer, 32, "%d-%m-%Y %T", localtime(&seconds));
     MbedJSONValue* jsonTime = jsonFactory();
-    (*jsonTime)["time"] = buffer;
+    int timestamp = static_cast<int>(seconds);
+    (*jsonTime)["time"] = timestamp;
     print(jsonTime);
     delete jsonTime;   
 }
@@ -83,3 +82,14 @@
     print(json);
     delete json;
 }
+
+void JsonReporter::battery(float battery_value)
+{
+    MbedJSONValue* json = jsonFactory();
+    const char property[] = "battery";
+    
+    (*json)[property] = battery_value;
+    
+    print(json);
+    delete json;    
+}
\ No newline at end of file