Hi!!! I am testing a code for a project with ArduinoJson and i need to save the Json char in EEPROM, but isn't possible to save in char and that i know. How to i convert the json array to byte??? I am a little rusty right now xD
#include <EEPROM.h>
#include <ArduinoJson.h>
int temp;
int humidity;
char json[80];
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.read() == 'j'){ //JSON WRITE
DynamicJsonBuffer jBuffer;
JsonObject& root = jBuffer.createObject();
temp=25;
humidity=40;
root["day"] = "Monday";
root["temperature"] = temp;
root["humidity"] = humidity;
root.prettyPrintTo(json);
//I NEED TO WRITE WERE JSON TO EEPROM
Serial.println("EEPROM SAVED");
}
if (Serial.read() == 'a'){ // JSONPARSE
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(json);
const char* days = root["day"];
int temp = root["temperature"];
int humidity = root["humidity"];
// Print values.
Serial.println(days);
Serial.println(temp);
Serial.println(humidity);
}
}