 #define PIN_6 46
 #define PIN_7 47
 
-int pin_1_value = RELAY_OFF;            
-int pin_2_value = RELAY_OFF;           
-int pin_3_value = RELAY_OFF;  
-int pin_4_value = RELAY_OFF;  
-int pin_5_value = RELAY_OFF; 
-int pin_6_value = RELAY_OFF; 
-int pin_7_value = RELAY_OFF; 
+#define PWM_PIN_1 8
+
+int pin_1_value = RELAY_OFF;
+int pin_2_value = RELAY_OFF;
+int pin_3_value = RELAY_OFF;
+int pin_4_value = RELAY_OFF;
+int pin_5_value = RELAY_OFF;
+int pin_6_value = RELAY_OFF;
+int pin_7_value = RELAY_OFF;
+
+int pwm_pin_1_value = LOW; 
 
 /* store the HTML in program memory using the P macro */
 P(On) = "<status>ON</status>";
 P(Off) = "<status>OFF</status>";
+
+// переписать тоже на макрос?
+void printPwmStatus(pwm_value){
+  P(pwmMsg) = "<status></status>"; // дописать
+  server.printP(pwmMsg);
+}
 
 void httpNotFound(WebServer &server){
   P(failMsg) =

        if(strcmp(url_path[1], "ON") == 0){
         value = RELAY_ON;
        }
        
        pin_number = atol(url_path[0]);
        
        switch (pin_number) {

  { 
    boolean is_on = false;
    int pin_number;
    int pwm_value = -1;
    
    pin_number = atol(url_path[0]);
              
    switch (pin_number) {
      case PIN_1:
        if(pin_1_value == RELAY_ON)
        {is_on = true;}
        break;
      case PIN_2:
        if(pin_2_value == RELAY_ON)
        {is_on = true;}
        break;
       case PIN_3:
        if(pin_3_value == RELAY_ON)
        {is_on = true;}
        break;
       case PIN_4:
        if(pin_4_value == RELAY_ON)
        {is_on = true;}
        break;
      case PIN_5:
        if(pin_5_value == RELAY_ON)
        {is_on = true;}
        break;
      case PIN_6:
        if(pin_6_value == RELAY_ON)
        {is_on = true;}
        break;
      case PIN_7:
        if(pin_7_value == RELAY_ON)
        {is_on = true;}
        break;
      case PWM_PIN_1:
        pwm_value = pwm_pin_1_value;
        break;
    }
    
    if (pwm_value >= 0)
    {
      printPwmStatus( pwm_value );
    } else
    {
      if(is_on)
      { 
        server.printP( On );
      } else 
      {
        server.printP( Off );
      }
    }
   
  }
}
