想使用APConfig进行配网,程序总是验证不过去,请大神指教-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1342|回复: 4

[已解答] 想使用APConfig进行配网,程序总是验证不过去,请大神指教

[复制链接]
发表于 2020-4-26 10:37 | 显示全部楼层 |阅读模式

程序如下:
#define BLINKER_WIFI
#define BLINKER_APCONFIG

#include <Blinker.h>

//char auth[] = "b1ac8363d080";
//char ssid[] = "DianZhanYuan";
//char pswd[] = "6163a51a0272";


#include <DHT.h>


BlinkerNumber HUMI("humi");
BlinkerNumber TEMP("temp");

#define DHTPIN D5

#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

DHT dht(DHTPIN, DHTTYPE);

float humi_read = 0, temp_read = 0;

void dataStorage()
{
    Blinker.dataStorage("temp", temp_read);
    Blinker.dataStorage("humi", humi_read);
}

//void heartbeat()
//{
//    HUMI.print(humi_read);
//    TEMP.print(temp_read);
//}

void setup()
{
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);
    BLINKER_DEBUG.debugAll();
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, LOW);

    Blinker.begin( );//此处参数为空?auth, ssid, pswd
    Blinker.attachDataStorage(dataStorage);
//    Blinker.attachHeartbeat(heartbeat);
    dht.begin();
}

void loop()
{
    Blinker.run();

    float h = dht.readHumidity();
    float t = dht.readTemperature();

    if (isnan(h) || isnan(t))
    {
        BLINKER_LOG("Failed to read from DHT sensor!");
    }
    else
    {
        BLINKER_LOG("Humidity: ", h, " %");
        BLINKER_LOG("Temperature: ", t, " *C");
        HUMI.print(h);
        TEMP.print(t);
        humi_read = h;
        temp_read = t;
    }

    Blinker.delay(2000);
}


报错信息:
Arduino:1.8.7 (Windows 10), 开发板:"ESPDuino (ESP-13 Module), ESPduino-V2, 80 MHz, Flash, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from C:\Users\lenovo\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:10:0,

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

                 from C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:4:

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

C:\Users\lenovo\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h:684:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

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

                 from C:\Users\lenovo\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,

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

                 from C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:4:

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

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

                 else return "false";

                             ^

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

                 from C:\Users\lenovo\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,

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

                 from C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:4:

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

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

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

                                                                                      ^

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

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

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

                                                                                   ^

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

C:\Users\lenovo\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:228: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\lenovo\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11:0,

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

                 from C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:4:

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

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

         BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);

                                                                                                 ^

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

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

         else return "";

                     ^

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

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

         else return "false";

                     ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino: At global scope:

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:14:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerNumber HUMI("humi");

                          ^

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:15:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerNumber TEMP("temp");

                          ^

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino: In function 'void dataStorage()':

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:29:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     Blinker.dataStorage("temp", temp_read);

                                          ^

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:30:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     Blinker.dataStorage("humi", humi_read);

                                          ^

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino: In function 'void setup()':

YanZheng-AP-MoShi:47:20: error: no matching function for call to 'BlinkerESPMQTT::begin()'

     Blinker.begin( );//姝ゅ鍙傛暟涓虹┖auth, ssid, pswd

                    ^

C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:47:20: note: candidate is:

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

                 from C:\Users\lenovo\Desktop\YanZheng-AP-MoShi\YanZheng-AP-MoShi.ino:4:

C:\Users\lenovo\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:32:14: note: void BlinkerESPMQTT::begin(const char*)

         void begin(const char* _auth)

              ^

C:\Users\lenovo\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:32:14: note:   candidate expects 1 argument, 0 provided

exit status 1
no matching function for call to 'BlinkerESPMQTT::begin()'

在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。


360截图20200426103532031.jpg
发表于 2020-4-26 10:59 | 显示全部楼层
本帖最后由 out 于 2020-4-26 11:18 编辑

括号要加配网
Blinker.begin(auth);//此处参数为空?auth, ssid, pswd
 楼主| 发表于 2020-4-26 11:16 | 显示全部楼层
本帖最后由 小二元 于 2020-4-26 11:23 编辑
out 发表于 2020-4-26 10:59
括号要加配网
Blinker.begin(auth,ssid,pswd );//此处参数为空?auth, ssid, pswd

改了还是有错误,已经试验过了,应该改为Blinker.begin(auth);谢谢了
发表于 2020-4-26 11:24 | 显示全部楼层
本帖最后由 out 于 2020-4-26 11:25 编辑

去掉虚拟路径   char auth[] = "b1ac8363d080";
Blinker.begin(auth);//此处参数为空?auth, ssid, pswd
发表于 2020-4-27 10:31 | 显示全部楼层
错误的地方改成(char*),比如: else return "";
改成: else return (char*)"";
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-28 07:31 , Processed in 0.079690 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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