|
楼主 |
发表于 2021-5-19 11:12
|
显示全部楼层
关于builtin_switch,我已经把下面的代码加了进去,但在设备图标上面为什么不显示开关按钮
void switch_callback(const String & state){ //设备总开关
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); //总是让LED灯发生明灭变化
BLINKER_LOG("get builtin switch state: ", state);
if (state == BLINKER_CMD_ON) { //BLINKER_CMD_ON="on"
switch_state = true;
digitalWrite(D7, HIGH);
BUILTIN_SWITCH.print("on");
}
else if (state == BLINKER_CMD_OFF) {
switch_state = false;
digitalWrite(D7, LOW);
BUILTIN_SWITCH.print("off");
}
}
void setup( ){
......
BUILTIN_SWITCH.attach(switch_callback); //设备总开关
} |
|