我是跟着视频一步步学着做的,然后学着视频编写好程序后,上传就报了一堆的错误。我看不太懂,有没有大佬可以教教我?
这是我的代码。跟着一个up主写的。
#define BLINKER_WIFI
#define BLINKER_MIOT_OUTLET //小爱同学
#include <Blinker.h>
char auth[] = "1110d54f9586"; //设备key
char ssid[] = "你三大爷"; //路由器wifi ssid
char pswd[] = "13250507146"; //路由器wifi 密码
BlinkerButton Button1("btn-aaa"); //定义按钮键名
bool oState = false;
int counter = 0;
void miotPowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) { //小爱同学控制开命令 此处修改为点动模式,适合按钮操作,
digitalWrite(0, LOW);
delay(200);
digitalWrite(0, HIGH);
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
oState = true;
}
else if (state == BLINKER_CMD_OFF) { //小爱同学控制关命令 此处修改为点动模式,适合按钮操作,
digitalWrite(0,LOW);
delay(200);
digitalWrite(0, HIGH);
BlinkerMIOT.powerState("off");
BlinkerMIOT.print();
oState = false;
}
}
void miotQuery(int32_t queryCode) //小爱同学控制
{
BLINKER_LOG("MIOT Query codes: ", queryCode);
switch (queryCode)
{
case BLINKER_CMD_QUERY_ALL_NUMBER :
BLINKER_LOG("MIOT Query All");
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
case BLINKER_CMD_QUERY_POWERSTATE_NUMBER :
BLINKER_LOG("MIOT Query Power State");
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
default :
BlinkerMIOT.powerState(oState ? "on" : "off");
BlinkerMIOT.print();
break;
}
}
void dataRead(const String & data) // 如果未绑定的组件被触发,则会执行其中内容
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
}
void button1_callback(const String & state) //点灯app内控制按键触发
{
BLINKER_LOG("get button state: ", state);
digitalWrite(0,LOW);
delay(200);
digitalWrite(0, HIGH);
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(0, OUTPUT); //定义io口为输出
digitalWrite(0, HIGH); //定义io默认为高电平
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
BlinkerMIOT.attachPowerState(miotPowerState);
BlinkerMIOT.attachQuery(miotQuery);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
}
然后报错了。。。
In file included from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:10:0,
from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\Administrator\Desktop\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h: In member function 'virtual char* BlinkerMQTT::lastRead()':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h:683:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
In file included from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:82:0,
from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,
from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\Administrator\Desktop\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h: In member function 'char* BlinkerBridge_key::getName()':
C:\Users\Administrator\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\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:83:0,
from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,
from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\Administrator\Desktop\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::deviceName()':
C:\Users\Administrator\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\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::authKey()':
C:\Users\Administrator\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\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::dataParse()':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:234: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\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11:0,
from C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\Administrator\Desktop\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:777:97: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);
^
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeKey(uint8_t)':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6380:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeName(uint8_t)':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6387:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "false";
^
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_str(uint8_t)':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7012:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_rgb(uint8_t)':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7026:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_int(uint8_t)':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7032:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_tab(uint8_t)':
C:\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7038:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\Administrator\Desktop\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino: At global scope:
C:\Users\Administrator\Desktop\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:9:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
BlinkerButton Button1("btn-aaa"); //定义按钮键名
^
Executable segment sizes:
IROM : 495608 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 28024 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)
DATA : 1400 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 5468 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 30064 ) - zeroed variables (global, static) in RAM/HEAP
项目使用了 530500 字节,占用了 (55%) 程序存储空间。最大为 958448 字节。
全局变量使用了36932字节,(45%)的动态内存,余留44988字节局部变量。最大为81920字节。
Serial port not selected.
|