|
这样就可以
BLINKER_LOG("need set outlet: ", num, ", power state: ", state);
Text3.print(state); ///////
if (state == BLINKER_CMD_ON) {
Serial.println(num);
switch (num)
{
case 1:
digitalWrite(zaoming,LOW);
cp1=true;
Serial.println("cp1: on");
Text2.print("照明打开");
break;
case 2:
digitalWrite(guolv,LOW);
cp2=true;
Serial.println("cp2: on");
Text2.print("过滤打开");
break;
}
BlinkerMIOT.powerState("on", num);
BlinkerMIOT.print();
oState[num] = true;
}
else if (state == BLINKER_CMD_OFF) {
switch (num)
{
case 1:
digitalWrite(zaoming,HIGH);
cp1=false;
Serial.println("cp1: off");
Text2.print("照明关闭");
break;
case 2:
digitalWrite(guolv,HIGH);
cp2=false;
Serial.println("cp2: off");
Text2.print("过滤关闭");
break;
}
BlinkerMIOT.powerState("off", num);
BlinkerMIOT.print();
oState[num] = false;
} |
|