代码编译报错,百度无果,求助各位大佬
报错
'button1_callback' was not declared in this scope; did you mean 'botton1_callback'?
代码如下
#define BLINKER_WIFI
#define BLINKER_MIOT_OUTLET
#include <Blinker.h>
char auth[] = "1323ba18a674"; //设备密钥
char ssid[] = "LRH"; //ssid
char pswd[] = "13399162346li"; //password
BlinkerButton Button1("btn-abc"); //定义按钮名字
bool oState = false;
void botton1_callback(const String & state)
{
BLINKER_LOG("get button state: ",state);
digitalWrite(0,LOW);
Blinker.delay(200); //点灯APP内控按键触发
digitalWrite(0,HIGH);
}
void miotPowerState(const String & state)
{
BLINKER_LOG("need set power state: ", state);
if (state == BLINKER_CMD_ON) {
digitalWrite(0,LOW);
Blinker.delay(200);
digitalWrite(0,HIGH); //小爱同学控制命令 开 此处修改为点动模式,适合按钮操作
BlinkerMIOT.powerState("on");
BlinkerMIOT.print();
oState = true;
}
else if (state == BLINKER_CMD_OFF) {
digitalWrite(0,LOW);
Blinker.delay(200); //小爱同学控制命令 关 此处修改为点动模式,适合按钮操作
digitalWrite(0,HIGH);
BlinkerMIOT.powerState("off");
BlinkerMIOT.print();
oState = false;
}
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(0, OUTPUT); //定义IO口为输出
digitalWrite(0, HIGH); //定义IO默认高电平
Blinker.begin(auth, ssid, pswd);
BlinkerMIOT.attachPowerState(miotPowerState);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
} |