NB-IoT案例编译存在问题-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 647|回复: 2

[已解答] NB-IoT案例编译存在问题

[复制链接]
发表于 2021-2-24 23:17 | 显示全部楼层 |阅读模式
各位大佬好,本人正在尝试使用NB-IoT将Arduino DUE接入blinker,但是使用官网的NB-IoT的案例程序,并按照指导更改后,无法成功编译,具体的程序及报错如下:
  1. #define BLINKER_NBIOT_SIM7020

  2. #include <Blinker.h>

  3. char auth[] = "7b08754dfb70";

  4. // 新建组件对象
  5. BlinkerButton Button1("btn-abc");
  6. BlinkerNumber Number1("num-abc");

  7. int counter = 0;

  8. // 按下按键即会执行该函数
  9. void button1_callback(const String & state) {
  10.     BLINKER_LOG("get button state: ", state);
  11.     digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
  12. }

  13. // 如果未绑定的组件被触发,则会执行其中内容
  14. void dataRead(const String & data)
  15. {
  16.     BLINKER_LOG("Blinker readString: ", data);
  17.     counter++;
  18.     Number1.print(counter);
  19. }

  20. void setup() {
  21.     // 初始化串口
  22.     Serial.begin(115200);
  23.     BLINKER_DEBUG.stream(Serial);
  24.    
  25.     // 初始化有LED的IO
  26.     pinMode(LED_BUILTIN, OUTPUT);
  27.     digitalWrite(LED_BUILTIN, HIGH);
  28.     // 初始化blinker
  29.     Blinker.begin(auth, 52, 53, 9600);
  30.     Blinker.attachData(dataRead);
  31.     Button1.attach(button1_callback);
  32. }

  33. void loop() {
  34.     Blinker.run();
  35. }
复制代码


报错信息是:
  1. In file included from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerialSIM7020.h:14:0,

  2.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialSIMNBIoT.h:8,

  3.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:163,

  4.                  from C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino:3:

  5. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/../Functions/BlinkerSIM7020.h:198:53: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  6.          bool getSNTP(float _tz = 8.0, char _url[] = "120.25.108.11")

  7.                                                      ^

  8. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/../Functions/BlinkerSIM7020.h: In member function 'bool BlinkerSIM7020::getSNTP(float, char*)':

  9. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/../Functions/BlinkerSIM7020.h:228:55: error: 'mk_gmtime' was not declared in this scope

  10.                          _ntpTime = mk_gmtime(&timeinfo) + (uint32_t)(_timezone * 3600);

  11.                                                        ^

  12. In file included from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialSIMNBIoT.h:8:0,

  13.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:163,

  14.                  from C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino:3:

  15. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerialSIM7020.h: In member function 'virtual char* BlinkerSerialSIM7020::lastRead()':

  16. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerialSIM7020.h:53:76: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  17.          char * lastRead() { if (isFresh_NBIoT) return msgBuf_NBIoT; return ""; }

  18.                                                                             ^

  19. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerialSIM7020.h: In member function 'virtual char* BlinkerSerialSIM7020::token()':

  20. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerialSIM7020.h:68:50: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  21.          char * token() { if (!isMQTTinit) return ""; else return MQTT_KEY_NBIoT; }

  22.                                                   ^

  23. In file included from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:95:0,

  24.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialSIMNBIoT.h:9,

  25.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:163,

  26.                  from C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino:3:

  27. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h: In member function 'char* BlinkerBridge_key::getName()':

  28. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h:196:29: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  29.                  else return "false";

  30.                              ^

  31. In file included from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:96:0,

  32.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialSIMNBIoT.h:9,

  33.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:163,

  34.                  from C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino:3:

  35. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::deviceName()':

  36. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:104:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  37.              char * deviceName() { if (isInit) return conn->deviceName(); else return ""; }

  38.                                                                                       ^

  39. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::authKey()':

  40. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:105:83: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  41.              char * authKey()    { if (isInit) return conn->authKey(); else return "";  }

  42.                                                                                    ^

  43. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::token()':

  44. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:106:79: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  45.              char * token()    { if (isInit) return conn->token(); else return "";  }

  46.                                                                                ^

  47. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::dataParse()':

  48. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:257:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  49.          char* dataParse()       { if (canParse) return conn->lastRead(); else return ""; }

  50.                                                                                       ^

  51. In file included from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialSIMNBIoT.h:9:0,

  52.                  from C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:163,

  53.                  from C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino:3:

  54. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:

  55. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:850:97: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  56.          BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);

  57.                                                                                                  ^

  58. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'bool BlinkerApi::ntpInit()':

  59. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:1816:67: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  60.                          if (!BLINKER_SIM7020.getSNTP(getTimezone())) return false;

  61.                                                                    ^

  62. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'void BlinkerApi::run()':

  63. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:3896:76: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  64.                          if (BLINKER_SIM7xxx.checkStream("NORMAL POWER DOWN"))

  65.                                                                             ^

  66. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:3923:76: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  67.                          if (BLINKER_SIM7xxx.checkStream("NORMAL POWER DOWN"))

  68.                                                                             ^

  69. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:4518:84: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  70.                                  if (BLINKER_SIM7xxx.checkStream("NORMAL POWER DOWN"))

  71.                                                                                     ^

  72. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int8_t BlinkerApi::second()':

  73. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5138:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  74.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  75.                                                                ^

  76. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int8_t BlinkerApi::minute()':

  77. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5210:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  78.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  79.                                                                ^

  80. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int8_t BlinkerApi::hour()':

  81. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5281:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  82.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  83.                                                                ^

  84. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int8_t BlinkerApi::mday()':

  85. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5353:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  86.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  87.                                                                ^

  88. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int8_t BlinkerApi::wday()':

  89. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5424:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  90.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  91.                                                                ^

  92. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int8_t BlinkerApi::month()':

  93. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5496:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  94.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  95.                                                                ^

  96. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int16_t BlinkerApi::year()':

  97. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5568:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  98.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  99.                                                                ^

  100. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int16_t BlinkerApi::yday()':

  101. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5640:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  102.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  103.                                                                ^

  104. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'time_t BlinkerApi::time()':

  105. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5716:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  106.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  107.                                                                ^

  108. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'int32_t BlinkerApi::dtime()':

  109. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:5801:63: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  110.                      if (!BLINKER_SIM7020.getSNTP(getTimezone())) return -1;

  111.                                                                ^

  112. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_str(uint8_t)':

  113. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:8082:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  114.      else return "";

  115.                  ^

  116. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_joy(uint8_t)':

  117. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:8089:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  118.          else return "";

  119.                      ^

  120. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_rgb(uint8_t)':

  121. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:8096:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  122.      else return "";

  123.                  ^

  124. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_int(uint8_t)':

  125. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:8102:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  126.      else return "";

  127.                  ^

  128. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_tab(uint8_t)':

  129. C:\Users\JZ\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:8108:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  130.      else return "";

  131.                  ^

  132. C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino: At global scope:

  133. C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino:8:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  134. BlinkerButton Button1("btn-abc");

  135.                                 ^

  136. C:\Users\JZ\Documents\Arduino\sketch_feb24a\sketch_feb24a.ino:9:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  137. BlinkerNumber Number1("num-abc");

  138.                                 ^

  139. exit status 1
  140. 为开发板 Arduino Due (Programming Port) 编译时出错。
复制代码
发表于 2021-2-25 08:51 | 显示全部楼层
头文件要坐等更新了。。。有一定编程能力的话,按着出错提示自己手动改改
发表于 2021-2-25 09:08 | 显示全部楼层
没有适配due,建议先使用mega2560,或者自行在lib中添加due相关配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 14:53 , Processed in 0.160898 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表