Hi,
I want to create a JSON array using Arduino UNO. I was able to create a JSON format for three sensor values (code below); however, I need to put all JSON values in an array format like the format below :
[
{
"Vacuum RPM" :900,
"Vacuum Height" :2,
"Tractor Speed" :5
}
]
How can I edit the code below for this purpose?
I appreciate any help in advance.
Abbas
#include <ArduinoJson.h>
StaticJsonDocument<1000> doc;
void setup()
{
Serial.begin( 9600 );
}
void loop()
{
int rpm = 900;
int Measured_Height= 2;
int speed = 5;
doc["RPM"] = rpm;
doc["Height"] = Measured_Height;
doc["Speed"] = speed;
serializeJsonPretty(doc, Serial);
Serial.println();
delay(1000);
}