用小爱同学控制esp8266没反应进入点灯点击开关正常,求助
#define BLINKER_WIFI#define BLINKER_MIOT_OUTLET
#include <Blinker.h>
char auth[] = "8781567963dd";
char ssid[] = "CMCC";
char pswd[] = "994805995";
BlinkerButton Buttonl{"btn-CMCC"};
bool oState = false;
void buttonl_callback(const String & state)
{
BLINKER_LOG("get button state;",state);
digitalWrite(0,LOW);
Blinker.delay(200);
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);
digitalWrite(0,HIGH);
Blinker.begin(auth, ssid, pswd);
BlinkerMIOT.attachPowerState(miotPowerState);
Buttonl.attach(buttonl_callback);
}
void loop()
{
Blinker.run();
}
1.确保package和lib是通过文档下载的最新版
2.debugall查看调试信息
https://www.arduino.cn/thread-84332-1-1.html 看串口输出就知道了
页:
[1]