티스토리 뷰

void b_PostprocessWebCommand(char CommandType1, char CommandType2, String CommandString){
  switch(CommandType1){
    case 'P': // Port control of WiFi device
    {
      int PortValue = 0;
      int PortNo = 0;
      PortValue = (int) CommandString.toInt();
      if(CommandType2 == 'R'){ // Port control for RELAY
        PortNo = PIN_RELAY;
        if(PortValue == 1) IsPowerON = true;
        if(PortValue == 0) IsPowerON = false;
      }else if(CommandType2 == 'O'){ // Port control for RELAY
        PortNo = PIN_BUZZER;
      }else{
        PortNo = (int)(String(CommandType2).toInt());
        if(PortNo == 0) return;
      }
      if(PortValue == 1) digitalWrite(PortNo, HIGH);
      if(PortValue == 0) digitalWrite(PortNo, LOW);
    }
      break;
    case 'R': // Request
    {
      switch(CommandType2){
        case '0':  // for THE WiFi device
          b_CheckAnalogInput();
          break;
        case 'L': // list of sub devices
          b_SendDeviceList();
          break;
        case 'D': // Data
          RxCommand_WiFi = CommandString;
          IsCommandFromWeb = true;
          break;
        case 'C': // Command
          RxCommand_WiFi = CommandString;
          IsCommandFromWeb = true;
          break;
      }
    }  
      break;
  }
}
반응형
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함