小爱同学不能关灯问题-Arduino中文社区 - Powered by Discuz! Archiver

guoweian 发表于 2020-4-9 18:16

小爱同学不能关灯问题

解决关灯问题,补充语句if (colorW > 0) colorW = 0;



void miotPowerState(const String & state)
{
    BLINKER_LOG("need set power state: ", state);

    if (state == BLINKER_CMD_ON) {
      digitalWrite(LED_BUILTIN, HIGH);

      BlinkerMIOT.powerState("on");
      BlinkerMIOT.print();

      wsState = true;

      if (colorW == 0) colorW = 255;
    }
    else if (state == BLINKER_CMD_OFF) {
      digitalWrite(LED_BUILTIN, LOW);

      BlinkerMIOT.powerState("off");
      BlinkerMIOT.print();

      wsState = false;

      if (colorW > 0) colorW = 0;   //定义colorW = 0
    }

    pixelShow();
}
页: [1]
查看完整版本: 小爱同学不能关灯问题