Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1.   if(SD.exists(jsonFileName)){
  2.     Serial.println("++Config file");
  3.     DynamicJsonDocument jsonData(JSONMAXCAPACITY) ;
  4.     jsonFile = SD.open(jsonFileName,FILE_READ);
  5.     if(!jsonFile)
  6.     {
  7.       Serial.println("Can't read conf file.");
  8.     }
  9.   /*  while (jsonFile.available()) {
  10.       Serial.write(jsonFile.read());
  11.     }*/
  12.     deserializeJson(jsonData, jsonFile);
  13.     auto error = deserializeJson(jsonData, jsonFile);
  14.     if (error) {
  15.       Serial.print(F("deserializeJson() failed with code "));
  16.       Serial.println(error.c_str());
  17.       return;
  18.     }
  19.     const char* value = jsonData["name"];
  20.     Serial.println(value);
  21.     jsonFile.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement