4Dof Robot Arm ESP-32 WEBサーバー マルチサーボコントロール　MultiServo WEB Control 

４DOF用のコントローラーがやっと出来ました。
といっても、Qiitaの別の方のプログラムを引用しています。

ESP32でwebserverを立ち上げてRGBLEDをスマホから調光する
https://qiita.com/wak_tech/items/60d993bb85e519a047b0

さらにこの方の元記事は
ESP32 Servo Motor Web Server with Arduino IDE
https://randomnerdtutorials.com/esp32-servo-motor-web-server-arduino-ide/


@wak_tech さんのプログラムは
ledc settingを使い(チャネル,Max,Bit)にしています。
myservo.write(valueString.toInt());
のServo.hをいじって、チャネル設定を入れるなり
svA.attach(svA_p);
svA.write(sv[A]);
と言う書き方をするべきなんですが、私の力量が足りず出来ていません

このため、ledc を流用し最大値をいじっています。
角度で言えば180度ですが調整が出来ておらずMax60で設定しています。

使われる方は、注意して下さい。

![IMG_9268.JPG](https://qiita-image-store.s3.amazonaws.com/0/285344/58bcee54-cb85-3d2f-9488-9266d1817a81.jpeg)

https://www.youtube.com/watch?v=mLfZmHvwZJA


```
#include <WiFi.h>

// 使用するWi-Fiとそのパスワードに書き換えてください
const char* ssid     = "ssid";
const char* password = "password";

// ポート80番を使用
WiFiServer server(80);

// HTTPリクエストを格納する変数
String header;

// 値の設定に使用する変数
String valueString = String(5);
int pos1 = 0;
int pos2 = 0;

//ledpin
const int ServoA = 13;
const int ServoB = 14;
const int ServoC = 15;
const int ServoD = 16;

void setup() {
  //ledc setting
  //ServoA
  ledcSetup(0, 90, 8);
  // ServoAをチャネル0へ接続
  ledcAttachPin(ServoA, 0);

  //ServoB
  ledcSetup(1, 90, 8);
  // ServoBをチャネル1へ接続
  ledcAttachPin(ServoB, 1);

  //ServoC
  ledcSetup(2, 90, 8);
  // ServoCをチャネル2へ接続
  ledcAttachPin(ServoC, 2);

  //ServoD
  ledcSetup(3, 90, 8);
  // ServoDをチャネル2へ接続
  ledcAttachPin(ServoD, 3);


  Serial.begin(115200);

  // Wi-Fiに接続
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  // ローカルIPを表示（このIPにスマホなどからアクセスします）
  Serial.println("");
  Serial.println("WiFi connected.");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  server.begin();
}

void loop() {
  WiFiClient client = server.available();   // Listen for incoming clients

  if (client) {                             // If a new client connects,
    Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        header += c;
        if (c == '\n') {                    // if the byte is a newline character
          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println("Connection: close");
            client.println();

            // Display the HTML web page
            client.println("<!DOCTYPE html><html>");
            client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>ESP32 RGB LED controller</title>");
            client.println("<link rel=\"icon\" href=\"data:,\">");
            // CSS to style the on/off buttons
            // Feel free to change the background-color and font-size attributes to fit your preferences
            client.println("<style>body { text-align: center; font-family: \"Trebuchet MS\", Arial; margin-left:auto; margin-right:auto;}");
            client.println("#servoPosR{color: red;}");
            client.println("#servoPosG{color: green;}");
            client.println("#servoPosB{color: blue;}");
            client.println(".slider { width: 300px; }</style>");
            client.println("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>");

            // Web Page
            client.println("</head><body><h1>ESP32 Multi Servo</h1>");
            //ServoA slide bar
            client.println("<p>Servo PosA: <span id=\"servoPosA\"></span></p>");
            client.println("<input type=\"range\" min=\"20\" max=\"50\" class=\"slider\" id=\"servoSliderA\" onchange=\"servo(this.value,'A')\" value=\"" + valueString + "\"/>");
            //ServoB slide bar
            client.println("<p>Servo PosB: <span id=\"servoPosB\"></span></p>");
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderB\" onchange=\"servo(this.value,'B')\" value=\"" + valueString + "\"/>");
            //ServoC slide bar
            client.println("<p>Servo PosC: <span id=\"servoPosC\"></span></p>");
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderC\" onchange=\"servo(this.value,'C')\" value=\"" + valueString + "\"/>");
            //ServoD slide bar
            client.println("<p>Servo PosD: <span id=\"servoPosD\"></span></p>");
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderD\" onchange=\"servo(this.value,'D')\" value=\"" + valueString + "\"/>");


            client.println("<script>");
            //send A value
            client.println("var sliderA = document.getElementById(\"servoSliderA\");");
            client.println("var servoPA = document.getElementById(\"servoPosA\"); servoPA.innerHTML = sliderA.value;");
            client.println("sliderA.oninput = function() { sliderA.value = this.value; servoPA.innerHTML = this.value; }");

            //send B value
            client.println("var sliderB = document.getElementById(\"servoSliderB\");");
            client.println("var servoPB = document.getElementById(\"servoPosB\"); servoPB.innerHTML = sliderB.value;");
            client.println("sliderB.oninput = function() { sliderB.value = this.value; servoPB.innerHTML = this.value; }");

            //send C value
            client.println("var sliderC = document.getElementById(\"servoSliderC\");");
            client.println("var servoPC = document.getElementById(\"servoPosC\"); servoPC.innerHTML = sliderC.value;");
            client.println("sliderC.oninput = function() { sliderC.value = this.value; servoPC.innerHTML = this.value; }");

            //send D value
            client.println("var sliderD = document.getElementById(\"servoSliderD\");");
            client.println("var servoPD = document.getElementById(\"servoPosD\"); servoPD.innerHTML = sliderD.value;");
            client.println("sliderD.oninput = function() { sliderD.value = this.value; servoPD.innerHTML = this.value; }");

            //HTTP getのための関数
            client.println("$.ajaxSetup({timeout:1000}); function servo(pos,color) { ");
            client.println("$.get(\"/?value\" + color + \"=\" + pos + \"&\"); {Connection: close};}</script>");

            client.println("</body></html>");

            //HTTPリクエストの処理部分
            //GET /?value=180& HTTP/1.1
            //ServoAの値をServoの出力に変換
            if (header.indexOf("GET /?valueA=") >= 0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1 + 1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(0, valueString.toInt());
              Serial.println(valueString);
            }
            //ServoBの値をServoの出力に変換
            if (header.indexOf("GET /?valueB=") >= 0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1 + 1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(1, valueString.toInt());
              Serial.println(valueString);
            }

            //ServoCの値をServoの出力に変換
            if (header.indexOf("GET /?valueC=") >= 0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1 + 1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(2, valueString.toInt());
              Serial.println(valueString);
            }

            //ServoDの値をServoの出力に変換
            if (header.indexOf("GET /?valueD=") >= 0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1 + 1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(3, valueString.toInt());
              Serial.println(valueString);
            }

            // HTTPレスポンスの終了
            client.println();
            // Break out of the while loop
            break;
          } else {
            currentLine = "";
          }
        } else if (c != '\r') {
          currentLine += c;
        }
      }
    }
    // Clear the header variable
    header = "";
    // 接続を切断
    client.stop();
    Serial.println("Client disconnected.");
    Serial.println("");
  }
}
```

16chバージョン

```
#include <WiFi.h>

// 使用するWi-Fiとそのパスワードに書き換えてください
const char* ssid     = "ssid";
const char* password = "password";

// ポート80番を使用
WiFiServer server(80);

// HTTPリクエストを格納する変数
String header;

// 値の設定に使用する変数
String valueString = String(5);
int pos1 = 0;
int pos2 = 0;

//ledpin
const int ServoA = 4;
const int ServoB = 5;
const int ServoC = 12;
const int ServoD = 13;
const int ServoE = 14;
const int ServoF = 15;
const int ServoG = 16;
const int ServoH = 17;
const int ServoI = 18;
const int ServoJ = 19;
const int ServoK = 21;
const int ServoL = 22;
const int ServoM = 27;
const int ServoN = 26;
const int ServoO = 25;
const int ServoP = 23;
void setup() {
  //ledc setting
  //ServoA
  ledcSetup(0, 90, 8);
  // ServoAをチャネル0へ接続
  ledcAttachPin(ServoA, 0);

  //ServoB
  ledcSetup(1, 90, 8);
  // ServoBをチャネル1へ接続
  ledcAttachPin(ServoB, 1);

  //ServoC
  ledcSetup(2, 90, 8);
  // ServoCをチャネル2へ接続
  ledcAttachPin(ServoC, 2);
  
  //ServoD
  ledcSetup(3, 90, 8);
  // ServoDをチャネル2へ接続
  ledcAttachPin(ServoD, 3);

  //ServoE
  ledcSetup(4, 90, 8);
  // ServoAをチャネル0へ接続
  ledcAttachPin(ServoE, 4);

  //ServoF
  ledcSetup(5, 90, 8);
  // ServoBをチャネル1へ接続
  ledcAttachPin(ServoF, 5);

  //ServoG
  ledcSetup(6, 90, 8);
  // ServoCをチャネル2へ接続
  ledcAttachPin(ServoG, 6);
  
  //ServoH
  ledcSetup(7, 90, 8);
  // ServoDをチャネル2へ接続
  ledcAttachPin(ServoH, 7);

    //ServoI
  ledcSetup(8, 90, 8);
  // ServoAをチャネル0へ接続
  ledcAttachPin(ServoI, 8);

  //ServoJ
  ledcSetup(9, 90, 8);
  // ServoBをチャネル1へ接続
  ledcAttachPin(ServoJ, 9);

  //ServoK
  ledcSetup(10, 90, 8);
  // ServoCをチャネル2へ接続
  ledcAttachPin(ServoK, 10);
  
  //ServoL
  ledcSetup(11, 90, 8);
  // ServoDをチャネル2へ接続
  ledcAttachPin(ServoL, 11);
  
    //ServoM
  ledcSetup(12, 90, 8);
  // ServoAをチャネル0へ接続
  ledcAttachPin(ServoM, 12);

  //ServoN
  ledcSetup(13, 90, 8);
  // ServoBをチャネル1へ接続
  ledcAttachPin(ServoN, 13);

  //ServoO
  ledcSetup(14, 90, 8);
  // ServoCをチャネル2へ接続
  ledcAttachPin(ServoO, 14);
  
  //ServoP
  ledcSetup(15, 90, 8);
  // ServoDをチャネル2へ接続
  ledcAttachPin(ServoP, 15);

  Serial.begin(115200);

  // Wi-Fiに接続
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  // ローカルIPを表示（このIPにスマホなどからアクセスします）
  Serial.println("");
  Serial.println("WiFi connected.");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  server.begin();
}

void loop(){
  WiFiClient client = server.available();   // Listen for incoming clients

  if (client) {                             // If a new client connects,
    Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        header += c;
        if (c == '\n') {                    // if the byte is a newline character
          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println("Connection: close");
            client.println();

            // Display the HTML web page
            client.println("<!DOCTYPE html><html>");
            client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>ESP32 RGB LED controller</title>");
            client.println("<link rel=\"icon\" href=\"data:,\">");
            // CSS to style the on/off buttons 
            // Feel free to change the background-color and font-size attributes to fit your preferences
            client.println("<style>body { text-align: center; font-family: \"Trebuchet MS\", Arial; margin-left:auto; margin-right:auto;}");
            client.println("#servoPosR{color: red;}");
            client.println("#servoPosG{color: green;}");
            client.println("#servoPosB{color: blue;}");
            client.println(".slider { width: 300px; }</style>");
            client.println("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>");

            // Web Page
            client.println("</head><body><h1>ESP32 Multi Servo</h1>");
            //ServoA slide bar
            client.println("<p>Servo PosA: <span id=\"servoPosA\"></span></p>");          
            client.println("<input type=\"range\" min=\"20\" max=\"50\" class=\"slider\" id=\"servoSliderA\" onchange=\"servo(this.value,'A')\" value=\""+valueString+"\"/>");
            //ServoB slide bar
            client.println("<p>Servo PosB: <span id=\"servoPosB\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderB\" onchange=\"servo(this.value,'B')\" value=\""+valueString+"\"/>");
            //ServoC slide bar
            client.println("<p>Servo PosC: <span id=\"servoPosC\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderC\" onchange=\"servo(this.value,'C')\" value=\""+valueString+"\"/>");
            //ServoD slide bar
            client.println("<p>Servo PosD: <span id=\"servoPosD\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderD\" onchange=\"servo(this.value,'D')\" value=\""+valueString+"\"/>");
            //ServoE slide bar
            client.println("<p>Servo PosE: <span id=\"servoPosE\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderE\" onchange=\"servo(this.value,'E')\" value=\""+valueString+"\"/>");
            //ServoF slide bar
            client.println("<p>Servo PosF: <span id=\"servoPosF\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderF\" onchange=\"servo(this.value,'F')\" value=\""+valueString+"\"/>");
            //ServoG slide bar
            client.println("<p>Servo PosG: <span id=\"servoPosG\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderG\" onchange=\"servo(this.value,'G')\" value=\""+valueString+"\"/>");
            //ServoH slide bar
            client.println("<p>Servo PosH: <span id=\"servoPosH\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderH\" onchange=\"servo(this.value,'H')\" value=\""+valueString+"\"/>");
            //ServoI slide bar
            client.println("<p>Servo PosI: <span id=\"servoPosI\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderI\" onchange=\"servo(this.value,'I')\" value=\""+valueString+"\"/>");
            //ServoJ slide bar
            client.println("<p>Servo PosJ: <span id=\"servoPosJ\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderJ\" onchange=\"servo(this.value,'J')\" value=\""+valueString+"\"/>");
            //ServoK slide bar
            client.println("<p>Servo PosK: <span id=\"servoPosK\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderK\" onchange=\"servo(this.value,'K')\" value=\""+valueString+"\"/>");
            //ServoL slide bar
            client.println("<p>Servo PosL: <span id=\"servoPosL\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderL\" onchange=\"servo(this.value,'L')\" value=\""+valueString+"\"/>");
            //ServoM slide bar
            client.println("<p>Servo PosM: <span id=\"servoPosM\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderM\" onchange=\"servo(this.value,'M')\" value=\""+valueString+"\"/>");
            //ServoN slide bar
            client.println("<p>Servo PosN: <span id=\"servoPosN\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderN\" onchange=\"servo(this.value,'N')\" value=\""+valueString+"\"/>");
            //ServoO slide bar
            client.println("<p>Servo PosO: <span id=\"servoPosO\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderO\" onchange=\"servo(this.value,'O')\" value=\""+valueString+"\"/>");
             //ServoP slide bar
            client.println("<p>Servo PosP: <span id=\"servoPosP\"></span></p>");          
            client.println("<input type=\"range\" min=\"1\" max=\"60\" class=\"slider\" id=\"servoSliderP\" onchange=\"servo(this.value,'P')\" value=\""+valueString+"\"/>");
                                   
            client.println("<script>");
            
            //send A value
            client.println("var sliderA = document.getElementById(\"servoSliderA\");");
            client.println("var servoPA = document.getElementById(\"servoPosA\"); servoPA.innerHTML = sliderA.value;");
            client.println("sliderA.oninput = function() { sliderA.value = this.value; servoPA.innerHTML = this.value; }");

            //send B value
            client.println("var sliderB = document.getElementById(\"servoSliderB\");");
            client.println("var servoPB = document.getElementById(\"servoPosB\"); servoPB.innerHTML = sliderB.value;");
            client.println("sliderB.oninput = function() { sliderB.value = this.value; servoPB.innerHTML = this.value; }");

            //send C value
            client.println("var sliderC = document.getElementById(\"servoSliderC\");");
            client.println("var servoPC = document.getElementById(\"servoPosC\"); servoPC.innerHTML = sliderC.value;");
            client.println("sliderC.oninput = function() { sliderC.value = this.value; servoPC.innerHTML = this.value; }");

            //send D value
            client.println("var sliderD = document.getElementById(\"servoSliderD\");");
            client.println("var servoPD = document.getElementById(\"servoPosD\"); servoPD.innerHTML = sliderD.value;");
            client.println("sliderD.oninput = function() { sliderD.value = this.value; servoPD.innerHTML = this.value; }");

            //send E value
            client.println("var sliderE = document.getElementById(\"servoSliderE\");");
            client.println("var servoPE = document.getElementById(\"servoPosE\"); servoPE.innerHTML = sliderE.value;");
            client.println("sliderE.oninput = function() { sliderE.value = this.value; servoPE.innerHTML = this.value; }");

            //send F value
            client.println("var sliderF = document.getElementById(\"servoSliderF\");");
            client.println("var servoPF = document.getElementById(\"servoPosF\"); servoPF.innerHTML = sliderF.value;");
            client.println("sliderF.oninput = function() { sliderF.value = this.value; servoPF.innerHTML = this.value; }");
            
            //send G value
            client.println("var sliderG = document.getElementById(\"servoSliderG\");");
            client.println("var servoPG = document.getElementById(\"servoPosG\"); servoPG.innerHTML = sliderG.value;");
            client.println("sliderG.oninput = function() { sliderG.value = this.value; servoPG.innerHTML = this.value; }");
            
            //send H value
            client.println("var sliderH = document.getElementById(\"servoSliderH\");");
            client.println("var servoPH = document.getElementById(\"servoPosH\"); servoPH.innerHTML = sliderH.value;");
            client.println("sliderH.oninput = function() { sliderH.value = this.value; servoPH.innerHTML = this.value; }");

            //send I value
            client.println("var sliderI = document.getElementById(\"servoSliderI\");");
            client.println("var servoPI = document.getElementById(\"servoPosI\"); servoPI.innerHTML = sliderI.value;");
            client.println("sliderI.oninput = function() { sliderI.value = this.value; servoPI.innerHTML = this.value; }");

            //send J value
            client.println("var sliderJ = document.getElementById(\"servoSliderJ\");");
            client.println("var servoPJ = document.getElementById(\"servoPosJ\"); servoPJ.innerHTML = sliderJ.value;");
            client.println("sliderJ.oninput = function() { sliderJ.value = this.value; servoPJ.innerHTML = this.value; }");

            //send K value
            client.println("var sliderK = document.getElementById(\"servoSliderK\");");
            client.println("var servoPK = document.getElementById(\"servoPosK\"); servoPK.innerHTML = sliderK.value;");
            client.println("sliderK.oninput = function() { sliderK.value = this.value; servoPK.innerHTML = this.value; }");

            //send L value
            client.println("var sliderL = document.getElementById(\"servoSliderL\");");
            client.println("var servoPL = document.getElementById(\"servoPosL\"); servoPL.innerHTML = sliderL.value;");
            client.println("sliderL.oninput = function() { sliderL.value = this.value; servoPL.innerHTML = this.value; }");

            //send M value
            client.println("var sliderM = document.getElementById(\"servoSliderM\");");
            client.println("var servoPM = document.getElementById(\"servoPosM\"); servoPM.innerHTML = sliderM.value;");
            client.println("sliderM.oninput = function() { sliderM.value = this.value; servoPM.innerHTML = this.value; }");
            
            //send N value
            client.println("var sliderN = document.getElementById(\"servoSliderN\");");
            client.println("var servoPN = document.getElementById(\"servoPosN\"); servoPN.innerHTML = sliderN.value;");
            client.println("sliderN.oninput = function() { sliderN.value = this.value; servoPN.innerHTML = this.value; }");

            //send O value
            client.println("var sliderO = document.getElementById(\"servoSliderO\");");
            client.println("var servoPO = document.getElementById(\"servoPosO\"); servoPO.innerHTML = sliderO.value;");
            client.println("sliderO.oninput = function() { sliderO.value = this.value; servoPO.innerHTML = this.value; }");

            //send P value
            client.println("var sliderP = document.getElementById(\"servoSliderP\");");
            client.println("var servoPP = document.getElementById(\"servoPosP\"); servoPP.innerHTML = sliderP.value;");
            client.println("sliderP.oninput = function() { sliderP.value = this.value; servoPP.innerHTML = this.value; }");

            //HTTP getのための関数
            client.println("$.ajaxSetup({timeout:1000}); function servo(pos,color) { ");
            client.println("$.get(\"/?value\" + color + \"=\" + pos + \"&\"); {Connection: close};}</script>");

            client.println("</body></html>");     

            //HTTPリクエストの処理部分
            //GET /?value=180& HTTP/1.1
            //ServoAの値をServoの出力に変換
            if(header.indexOf("GET /?valueA=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(0, valueString.toInt());
              Serial.println(valueString); 
            }  
            //ServoBの値をServoの出力に変換
            if(header.indexOf("GET /?valueB=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(1, valueString.toInt());
              Serial.println(valueString); 
            }  

            //ServoCの値をServoの出力に変換
            if(header.indexOf("GET /?valueC=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(2, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoDの値をServoの出力に変換
            if(header.indexOf("GET /?valueD=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(3, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoEの値をServoの出力に変換
            if(header.indexOf("GET /?valueE=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(4, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoFの値をServoの出力に変換
            if(header.indexOf("GET /?valueF=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(5, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoGの値をServoの出力に変換
            if(header.indexOf("GET /?valueG=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(6, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoHの値をServoの出力に変換
            if(header.indexOf("GET /?valueH=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(7, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoIの値をServoの出力に変換
            if(header.indexOf("GET /?valueI=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(8, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoJの値をServoの出力に変換
            if(header.indexOf("GET /?valueJ=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(9, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoKの値をServoの出力に変換
            if(header.indexOf("GET /?valueK=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringの値で点灯
              ledcWrite(10, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoL値をServo出力に変換
            if(header.indexOf("GET /?valueL=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringL値で点灯
              ledcWrite(11, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoM値をServo出力に変換
            if(header.indexOf("GET /?valueM=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringM値で点灯
              ledcWrite(12, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoN値をServo出力に変換
            if(header.indexOf("GET /?valueN=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringN値で点灯
              ledcWrite(13, valueString.toInt());
              Serial.println(valueString); 
            }
            
            //ServoO値をServo出力に変換
            if(header.indexOf("GET /?valueO=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringO値で点灯
              ledcWrite(14, valueString.toInt());
              Serial.println(valueString); 
            }   
                                 
            //ServoP値をServo出力に変換
            if(header.indexOf("GET /?valueP=")>=0) {
              pos1 = header.indexOf('=');
              pos2 = header.indexOf('&');
              valueString = header.substring(pos1+1, pos2);

              //ServoをvalueStringO値で点灯
              ledcWrite(15, valueString.toInt());
              Serial.println(valueString); 
            }
                        
            // HTTPレスポンスの終了
            client.println();
            // Break out of the while loop
            break;
          } else {
            currentLine = "";
          }
        } else if (c != '\r') {
          currentLine += c;
        }
      }
    }
    // Clear the header variable
    header = "";
    // 接続を切断
    client.stop();
    Serial.println("Client disconnected.");
    Serial.println("");
  }
}