|
ESP8266的单路控制器。之前可以写, 后面写进去老提示:expected identifier before ')' token
是用在单路继电器控制电脑开机的。
求大神帮我看一下是什么问题?
代码如下
#define BLINKER_WIFI
#define BLINKER_MIOT_OUTLET
#include <Blinker.h>
char auth[] = "*******";
char ssid[] = "***";
char pswd[] = "********";
BlinkerButton Button1("btn-abc"); //定义按钮键名
bool oState = false;
void button1_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 button 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);
Button1.attach(button1_callback);
}
void loop()
{
Blinker.run();
}
|
|