首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Arduino异常(9)

Arduino异常(9)
EN

Stack Overflow用户
提问于 2019-12-21 01:12:20
回答 1查看 981关注 0票数 0

我是ESP8266的初学者,每隔1:30分钟就会得到异常(9),我不知道为什么;经过一些测试后,我发现下面的代码是问题所在,但不知道为什么

代码语言:javascript
运行
复制
struct Schedule
  {
    int temperatureMin;
    int temperatureMax;
    bool manual;
    const char* startTime;
    int id;
    int systemId;
    const char* stopTime;
  };

Schedule GetScheduleBySystem(int systemId)
    {
      Schedule sch;
      http.begin(api+"/systems/"+systemId+"/schedule",fingerPrint); //Specify the URL
      int httpCode = http.GET();             
        if (httpCode > 0) { //Check for the returning code

          String payload = http.getString();
          Serial.println(httpCode);

          const size_t capacity = JSON_OBJECT_SIZE(7) + 238;
          DynamicJsonBuffer jsonBuffer(capacity);

          JsonObject& root = jsonBuffer.parseObject(payload);

          sch.startTime = root["start"]; // "2019-12-02T21:51:00"
          sch.temperatureMin = root["temperatureMin"]; // 22
          sch.temperatureMax = root["temperatureMax"]; // 32
          sch.manual = root["manual"]; // true
          sch.id = root["id"];
          sch.stopTime = root["stop"];
          sch.systemId = root["systemId"];
        }
        else 
        {
          Serial.println("Error on HTTP request");
        }
        http.end(); //Free the resources
        return sch;
    }
EN

回答 1

Stack Overflow用户

发布于 2020-02-25 04:49:19

深入研究了一段时间后,发现问题来自这行代码'http.getString()‘。通过将ESP8266软件版本从2.6.3降级到2.5.2,我摆脱了这个例外。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59429043

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档