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

zj3131031 发表于 2021-2-24 23:17

NB-IoT案例编译存在问题

各位大佬好,本人正在尝试使用NB-IoT将Arduino DUE接入blinker,但是使用官网的NB-IoT的案例程序,并按照指导更改后,无法成功编译,具体的程序及报错如下:#define BLINKER_NBIOT_SIM7020

#include <Blinker.h>

char auth[] = "7b08754dfb70";

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

int counter = 0;

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

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

void setup() {
    // 初始化串口
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);
   
    // 初始化有LED的IO
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);
    // 初始化blinker
    Blinker.begin(auth, 52, 53, 9600);
    Blinker.attachData(dataRead);
    Button1.attach(button1_callback);
}

void loop() {
    Blinker.run();
}

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

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

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

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

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]

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

                                                   ^

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

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

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

                                                       ^

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

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

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

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

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]

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

                                                                            ^

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

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]

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

                                                ^

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

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

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

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

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

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]

               else return "false";

                           ^

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

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

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

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

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

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]

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

                                                                                    ^

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

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]

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

                                                                                 ^

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

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]

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

                                                                               ^

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

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]

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

                                                                                    ^

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

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

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

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

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]

         BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);

                                                                                                 ^

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

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]

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

                                                                   ^

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

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]

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

                                                                            ^

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]

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

                                                                            ^

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]

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

                                                                                    ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

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

                                                               ^

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

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]

   else return "";

               ^

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

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]

         else return "";

                     ^

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

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]

   else return "";

               ^

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

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]

   else return "";

               ^

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

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]

   else return "";

               ^

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

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

BlinkerButton Button1("btn-abc");

                              ^

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

BlinkerNumber Number1("num-abc");

                              ^

exit status 1
为开发板 Arduino Due (Programming Port) 编译时出错。

花开千树 发表于 2021-2-25 08:51

头文件要坐等更新了。。。有一定编程能力的话,按着出错提示自己手动改改

奈何col 发表于 2021-2-25 09:08

没有适配due,建议先使用mega2560,或者自行在lib中添加due相关配置
页: [1]
查看完整版本: NB-IoT案例编译存在问题