Unknown error connected with ArduinoJson

I am trying to read and decode JSON from SD card. Using ESP-12E and this code:

#include <LiquidCrystal_I2C.h>

#include <ArduinoJson.h>

#include <OneWire.h>
#include <DallasTemperature.h>

#include <SPI.h>
#include <SD.h>
#include <Wire.h> 

File settings;

#define ONE_WIRE_BUS 2
#define TEMPERATURE_PRECISION 12

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

LiquidCrystal_I2C lcd(0x27, 20, 4);

class Termometr{
  public:
    DeviceAddress adres;
    String name;
    bool begin(String a, int b[8]){
      for (int i = 0; i <= 7; ++i) {
         adres[i] = b[i];
      }
      sensors.setResolution(adres,11);
      name = a;
      return true;
    }
    float getTemperature(){
      sensors.requestTemperatures();
      return sensors.getTempC(adres);
    }
};

Termometr termometry[4];

void setup() {
  Serial.begin(9600);
  Serial.println("");   
  SD.begin(27);
  lcd.begin(); 
  
  DynamicJsonDocument doc(1024);

  settings = SD.open("settings.json");
  
  deserializeJson(doc, settings);
  JsonObject obj = doc.as<JsonObject>();

  termometry[0].begin("Chlod",doc["termometers"][0]);
  termometry[1].begin("Glowi",doc["termometers"][1]);
  termometry[2].begin("Wypel",doc["termometers"][2]);
  termometry[3].begin("Zbior",doc["termometers"][3]);
  
  /*for (int i = 0; i <= 7; ++i) {
       termometry[0][i] = termometers[0][i];
       termometry[1][i] = termometers[1][i];
       termometry[2][i] = termometers[2][i];
       termometry[3][i] = termometers[3][i];
  }
   for (int i = 0; i < 4; ++i) {
       sensors.setResolution(termometry[i],11);
   
   }*/
        
  sensors.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
  float tempC0 = termometry[0].getTemperature();
    Serial.println("----------------------------");
    Serial.print(termometry[0].name + ": ");
    Serial.println(tempC0);
  lcd.setCursor(0,0);
  lcd.print(termometry[0].name + ": ");
  lcd.print(tempC0);
  float tempC1 = termometry[1].getTemperature();
    Serial.print(termometry[1].name + ": ");
    Serial.println(tempC1);
  lcd.setCursor(0,1);
  lcd.print(termometry[1].name + ": ");
  lcd.print(tempC1);
  float tempC2 = termometry[2].getTemperature();
    Serial.print(termometry[2].name + ": ");
    Serial.println(tempC2);
  lcd.setCursor(0,2);
  lcd.print(termometry[2].name + ": ");
  lcd.print(tempC2);
  float tempC3 = termometry[3].getTemperature();
    Serial.print(termometry[3].name + ": ");
    Serial.println(tempC3);
  lcd.setCursor(0,3);
  lcd.print(termometry[3].name + ": ");
  lcd.print(tempC3);
  delay(1000);
  sensors.requestTemperatures();
}

My ArduinoJSON version is 6.17.3 (latest from library manager)
Compilator returns this error:

How to fix it? Please help!

Please post a complete sketch that shows the problem

Please follow the advice on posting code given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

If the code exceeds the 9000 character inline limit then attach it to a post

Error was caused by trying to assingn object with JsonArray type to int[8]
I modified begin() in Termometr class:

    bool begin(String a, JsonArray b){
      for (int i = 0; i <= 7; ++i) {
         adres[i] = int(b[i]);
      }
      sensors.setResolution(adres,11);
      name = a;
      return true;
    }

And everything started working!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.