Thank you Juan.
I tested #4 and #5 as below with the same ESP32 code of #5 with pins resigned, #4 works well, #5 no thing happened pressed buttons, what can be?
if it is only work by web command button?
then how to do if I like to use MIT APP 's button to control the led ?

CODE:
/*
*
*/
// Juan A. Villalpando.
// KIO4.COM
// Enciende y apaga LED. Botones.
#include <WiFi.h>
const char* ssid = "Nombre_red_WiFi";
const char* password = "contraseña_red";
// Setting Static IP.
IPAddress local_IP(192, 168, 1, 115);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(8, 8, 8, 8); //opcional
IPAddress secondaryDNS(8, 8, 4, 4); //opcional
WiFiServer server(80); // Port 80
#define LED16 16 // LED12
#define LED17 17 // LED14
String estado = "";
int wait30 = 30000; // time to reconnect when connection is lost.
void setup() {
Serial.begin(115200);
pinMode(LED16, OUTPUT);
pinMode(LED17, OUTPUT);
// Setting Static IP.
if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
Serial.println("Error in configuration.");
}
// Connect WiFi net.
Serial.println();
Serial.print("Connecting with ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Connected with WiFi.");
// Start Web Server.
server.begin();
Serial.println("Web Server started.");
// This is IP
Serial.print("This is IP to connect to the WebServer: ");
Serial.print("http://");
Serial.println(WiFi.localIP());
}
void loop() {
// If disconnected, try to reconnect every 30 seconds.
if ((WiFi.status() != WL_CONNECTED) && (millis() > wait30)) {
Serial.println("Trying to reconnect WiFi...");
WiFi.disconnect();
WiFi.begin(ssid, password);
wait30 = millis() + 30000;
}
// Check if a client has connected..
WiFiClient client = server.available();
if (!client) {
return;
}
Serial.print("New client: ");
Serial.println(client.remoteIP());
// Espera hasta que el cliente envíe datos.
// while(!client.available()){ delay(1); }
/////////////////////////////////////////////////////
// Read the information sent by the client.
String req = client.readStringUntil('\r');
Serial.println(req);
// Make the client's request.
if (req.indexOf("on16") != -1) {digitalWrite(LED16, HIGH); estado = "LED16 ON";}
if (req.indexOf("off16") != -1){digitalWrite(LED16, LOW); estado = "LED16 OFF";}
if (req.indexOf("on17") != -1) {digitalWrite(LED17, HIGH); estado = "LED17 ON";}
if (req.indexOf("off17") != -1){digitalWrite(LED17, LOW); estado = "LED17 OFF";}
if (req.indexOf("consulta") != -1){
estado ="";
if (digitalRead(LED16) == HIGH) {estado = "LED16 ON,";} else {estado = "LED16 OFF,";}
if (digitalRead(LED17) == HIGH) {estado = estado + "LED17 ON";} else {estado = estado + "LED17 OFF";}
}
//////////////////////////////////////////////
// Página WEB. ////////////////////////////
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println(""); // Comillas importantes.
client.println(estado); // Return status.
client.flush();
client.stop();
Serial.println("Client disconnected.");
}