Hi all
I'm having a problem with ESP32 using ArduinoJson, I think it might be a system problem but i'm really not sure how to trouble shoot it
#include "painlessMesh.h"
#include <Streaming.h>
#include <Arduino_JSON.h>
#include <WiFi.h>
//#include <Preferences.h>
//#include <Scheduler.h>
#include <String.h>
//Preferences nvr;
//------------------------------------------
#define MESH_PREFIX "DavesMesh"
#define MESH_PASSWORD "DavesMesh"
#define MESH_PORT 5555
//------------------------------------------
//********************************************
// Dallas DS18B20 sensor
//********************************************
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire oneWire(32); // DallasTempPin);
DallasTemperature sensors(&oneWire);
// use sensors.begin(); in setup
//===============================================
Scheduler scheduler; // to control your personal task
JSONVar obj;
void setJson() {
obj["one"] = "One";
obj["two"] = "Two";
obj["three"] = "Three";
}
void setup() {
Serial.begin(115200);
setJson();
String fred = "Fred";
fred = obj["two"];
}
void loop() {
// put your main code here, to run repeatedly:
}
when i verify the sketch it comes up with an error:
ambiguous overload for operator= (operand types are String and JSONVar)
on the line fred = obj["two"];
I have tried this on V1.8.18 and V2.2.1
interestingly in 2.2.1 if I hover over fred a baloon comes up telling me that its an int ?????
I tried deleting and re installing both versions of Arduino but the same thing still happens
Hi J-M-L thanks for coming back to me
thats just confusing, it works but do you have an explanation of why ?
Ive been programming using painlessMesh and using the original type of statement throughout my node sketches with no problems then suddenly it started complaining and throwing its legs in the air
the fact that 2.2.1 came up with the bubble saying it was an int pointed to a system fault in my view, prompting the re install
Do you have any idea why this should suddenly start happening, no libs were updated as far as I know
Hi Jml
Thank you, i think my mistake is that i am using Arduino_Json.h lib
not ArduinoJson.h
There seem to be a lot of places where the lib i'm trying to use either does not work or needs a lot of get-arounds
I think my best option is to swap libs
Thanks for all your help
Dave