Hey, I'm new here, so my apologies! I'll try and create a list below
Here's pretty much the area of my code the issue is coming from. It fetches correctly as sensorReadings prints out. Do note this is a string like I said (I confirmed it with JSON.typeof()
void loop() {
if ((millis() - lastTime) > timerDelay) {
//Check WiFi connection status
if (WiFi.status() == WL_CONNECTED) {
sensorReadings = httpGETRequest(serverName);
Serial.println(sensorReadings);
JSONVar myObject = JSON.parse(sensorReadings);
Serial.println(JSON.typeof(myObject));
if (JSON.typeof(myObject) == "undefined") {
Serial.println("Parsing input failed!");
return;
}
}
Could say that my question is also that why won't it parse as it seems to be able to do this loop longer and then after a while the Guru Meditation Error comes up.
Like I said, I am using an ESP32 Dev kitC v4 development board
The code above is a portion of the full code, but is where it happens.
I recommend ArduinoJson from ArduinoJson.org. They have an "Assistant" that will write most of the code for you, given an example of the JSON document you want to serialize or deserialize. Assistant | ArduinoJson 6
It worked last night, but the json that is provided from the fetch is shorter during evening than peak day time. Could the length of the provided JSON be the issue then?
What version? The current version (V6) doesn't have a JSONvar object. It has a JsonVarient object and you need a DynamicJsonDocument or StaticJsonDocument to deserialize it:
// allocate the memory for the document
DynamicJsonDocument doc(1024);
// deserialize the object
char json[] = "42";
deserializeJson(doc, json);
// extract the data
JsonVariant variant = doc.as<JsonVariant>();
int value = variant.as<int>();
Are you sure? You may have it installed but it doesn't look like you are using it. It looks like ArduinoJson V5 doesn't have a JSONvar object type either.
Can you paste in an example of the JSON document you are receiving? Your picture only shows a few lines.
It seems to work now again, I guess it is too much memory to handle during the peak times. Is there any solution to this other than just getting a board that can handle more memory?