Hi,
I’m not sure if this is the right category so please correct me if wrong
I was following the tutorial for DataCake and found it used Variant class - this looks like it is a great way to package data for publishing. So to check it out i have played with the simplest of code - see below. However, both log.info serial output, and looking at events for this device show a different order of tag and data than it was constructed - what am I missing
Thanks for any help
Paul
// code snip
void publishCounter()
{
particle::Variant obj;
obj.set("counter", globalCount);
obj.set("timestamp", millis());
obj.set("bool", myBoolean);
obj.set("int", myInt);
obj.set("float", myFloat);
obj.set("string", myString);
event.name("datacake-pump-data");
event.data(obj);
Particle.publish(event);
Log.info("publishing %s", obj.toJSON().c_str());
}
// Log.info output
0001695028 [app] INFO: publishing {"bool":true,"counter":15,"float":3.1415,"int":1,"string":"Hello world!","timestamp":1695023}
0001695190 [app] INFO: publish succeeded
0001815028 [app] INFO: publishing {"bool":true,"counter":16,"float":3.1415,"int":1,"string":"Hello world!","timestamp":1815023}
0001815202 [app] INFO: publish succeeded