Description
Hello,
I've been using the following libraries for some LAN telemetry exercises:
#include <Ethernet.h>
#include <PubSubClient.h>
#include <Arduino_JSON.h>
#include <Arduino_MKRENV.h>
char pubTopic[] = "arduino/env/pub";
PubSubClient MQTTclient(MQTTserver, MQTTport, callbackSub, ETHclient);
JSONVar MQTTmsg; //!< MQTT message buffer
The following statement causes a problem after about ~72 hours of operation at 1 second interval:
MQTTclient.publish(pubTopic, ((String)JSON.stringify(MQTTmsg)).c_str());
Is my method to serialize the JSON object the culprit? The number of fields in the JSON object does not change with the iterations. All 10 fields except the first (which has a constant string value) are floats as in the example below:
MQTTmsg["Temperature"] = roundf(ENV.readTemperature(unitTemperature) * DECIMALS) / DECIMALS;
The two boards (MKR1000, UNO) where this failure occurs repeatedly require a manual RESET. (I disable the SD card for MKR1000 HATs during setup with SPI CS pin 4). Is there an alternate way to serialize the JSON object using the Arduino_JSON (and not the 3rd party JSON) library? Thanks.
Kind regards.