Как к web-кнопке подтянуть пин реле

Хотелось бы сделать веб интерфейс для дома. Проблема такая, как подтянуть пин к веб кнопке. Объясните мне пожалуйста по этапно куда и что подставить на пальцах, т.к. в С++ не силен. Заранее спасибо.

#ifdef ESP32
  #include <WiFi.h>
  #include <ESPAsyncWebServer.h>
#else
  #include <Arduino.h>
  #include <ESP8266WiFi.h>
  #include <Hash.h>
  #include <ESPAsyncTCP.h>
  #include <ESPAsyncWebServer.h>
#endif

// Замените ваши сетевые учетные данные
const char* ssid = "NBN";
const char* password = "zse4vh23";

// Создайте объект AsyncWebServer на порту 80
AsyncWebServer server(80);



String header;



const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head> <!-- Техническая информация о документе -->
 <meta charset=utf-8> <!-- Определяем кодировку символов документа -->
<title>Комната на втором этаже</title> <!-- Задаем заголовок документа -->




<style>
/* ЦВЕТ ФОНА */
body {
background-color: #000000 ;
}
</style>


/* МЕНЮ */ 
<style>
#menu
{
        width: 100%;
        margin: 0;
        padding: 10px 0 0 0;
        list-style: none;
        background: #111;
        background: -moz-linear-gradient(#444, #111);
    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
        background: -webkit-linear-gradient(#444, #111);
        background: -o-linear-gradient(#444, #111);
        background: -ms-linear-gradient(#444, #111);
        background: linear-gradient(#444, #111);
        -moz-border-radius: 50px;
        border-radius: 50px;
        -moz-box-shadow: 0 2px 1px #9c9c9c;
        -webkit-box-shadow: 0 2px 1px #9c9c9c;
        box-shadow: 0 2px 1px #9c9c9c;
}

#menu li
{
        float: left;
        padding: 0 0 10px 0;
        position: relative;
}

#menu a
{
        float: left;
        height: 25px;
        padding: 0 25px;
        color: #999;
        text-transform: uppercase;
        font: bold 12px/25px Arial, Helvetica;
        text-decoration: none;
        text-shadow: 0 1px 0 #000;
}

#menu li:hover > a
{
        color: #fafafa;
}

*html #menu li a:hover /* IE6 */
{
        color: #fafafa;
}

#menu li:hover > ul
{
        display: block;
}

/* Подменю */

#menu ul
{
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
    position: absolute;
    top: 35px;
    left: 0;
    z-index: 99999;
    background: #444;
    background: -moz-linear-gradient(#444, #111);
    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
    background: -webkit-linear-gradient(#444, #111);
    background: -o-linear-gradient(#444, #111);
    background: -ms-linear-gradient(#444, #111);
    background: linear-gradient(#444, #111);
    -moz-border-radius: 5px;
    border-radius: 5px;
}

#menu ul li
{
    float: none;
    margin: 0;
    padding: 0;
    display: block;
    -moz-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
    -webkit-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
    box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
}

#menu ul li:last-child
{
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

#menu ul a
{
    padding: 10px;
        height: auto;
    line-height: 1;
    display: block;
    white-space: nowrap;
    float: none;
        text-transform: none;
}

*html #menu ul a /* IE6 */
{
        height: 10px;
        width: 150px;
}

*:first-child+html #menu ul a /* IE7 */
{
        height: 10px;
        width: 150px;
}

#menu ul a:hover
{
    background: #0186ba;
        background: -moz-linear-gradient(#04acec,  #0186ba);
        background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
        background: -webkit-linear-gradient(#04acec,  #0186ba);
        background: -o-linear-gradient(#04acec,  #0186ba);
        background: -ms-linear-gradient(#04acec,  #0186ba);
        background: linear-gradient(#04acec,  #0186ba);
}

#menu ul li:first-child a
{
    -moz-border-radius: 5px 5px 0 0;
    border-radius: 5px 5px 0 0;
}

#menu ul li:first-child a:after
{
    content: '';
    position: absolute;
    left: 30px;
    top: -8px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #444;
}

#menu ul li:first-child a:hover:after
{
    border-bottom-color: #04acec;
}

#menu ul li:last-child a
{
    -moz-border-radius: 0 0 5px 5px;
    border-radius: 0 0 5px 5px;
}

#menu:after
{
        visibility: hidden;
        display: block;
        font-size: 0;
        content: " ";
        clear: both;
        height: 0;
}

* html #menu             { zoom: 1; } /* IE6 */
*:first-child+html #menu { zoom: 1; } /* IE7 */
</style>


/* ЦВЕТ ЗАГОЛОВКА */
<style>
 .colortext {
     color: #FFFFFF  ; /* белый цвет выделения */
   }
</style>


/*ТАБЛИЦА*/
<style>
table {
    overflow:hidden;
    border:1px solid #d3d3d3;
    background:#fefefe;
    width:70%;
    margin:5% auto 0;
    -moz-border-radius:5px; /* FF1+ */
    -webkit-border-radius:5px; /* Saf3-4 */
    border-radius:5px;
    -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
    -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

th, td {
    padding:18px 28px 18px; 
    text-align:center; 
}

th {
    padding-top:22px; 
    text-shadow: 1px 1px 1px #fff;
    background:#e8eaeb;
}

td {
    border-top:1px solid #e0e0e0; 
    border-right:1px solid #e0e0e0;
}

tr.odd-row td {
    background:#f6f6f6;
}

td.first, th.first {
    text-align:left
}

td.last {
    border-right:none;
}

td {
    background: -moz-linear-gradient(100% 25% 90deg, #fefefe, #f9f9f9);
    background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f9f9f9), to(#fefefe));
}

tr.odd-row td {
    background: -moz-linear-gradient(100% 25% 90deg, #f6f6f6, #f1f1f1);
    background: -webkit-gradient(linear, 0% 0%, 0% 25%, from(#f1f1f1), to(#f6f6f6));
}

th {
    background: -moz-linear-gradient(100% 20% 90deg, #e8eaeb, #ededed);
    background: -webkit-gradient(linear, 0% 0%, 0% 20%, from(#ededed), to(#e8eaeb));
}

tr:first-child th.first {
    -moz-border-radius-topleft:5px;
    -webkit-border-top-left-radius:5px; /* Saf3-4 */
}

tr:first-child th.last {
    -moz-border-radius-topright:5px;
    -webkit-border-top-right-radius:5px; /* Saf3-4 */
}

tr:last-child td.first {
    -moz-border-radius-bottomleft:5px;
    -webkit-border-bottom-left-radius:5px; /* Saf3-4 */
}

tr:last-child td.last {
    -moz-border-radius-bottomright:5px;
    -webkit-border-bottom-right-radius:5px; /* Saf3-4 */
}
</style>

/*КНОПКА*/
<style>
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

/* Hide default HTML checkbox */
.switch input {display:none;}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}
</style>



</head>
<body> 
<div>
<ul id="menu">
        <li><a href="index.html">Главная</a></li>
        <li>
                <!--<a href="#">Категории</a>
                <ul>
                        <li><a href="#">CSS</a></li>
                        <li><a href="#">Графический дизайн</a></li>
                        <li><a href="#">Инструменты разработчика</a></li>
                        <li><a href="#">Веб дизайн</a></li>
                </ul>-->
        </li>
        <li><a href="#">Комната 2</a></li>
        <li><a href="#">Комната 3</a></li>
        <li><a href="#">Коридор 1</a></li>
        <li><a href="#">Коридор 2</a></li>
        <li><a href="#">Веранда</a></li>
        <li><a href="#">Баня</a></li>
</div>

<p><h1 align="center"><span class="colortext">КОМНАТА 1</span></h1></p>



<table cellspacing="0">
    <tr>
        <th>№</th>
        <th>Наименование</th>
        <th>В подключино к ESP8266</th>
    </tr>
    <tr>
        <td>1.</td>
        <td>Люстра</td>
        <td>
<label class="switch">
  <input type="checkbox">
  <span class="slider round"></span>
</label>

<label class="switch">
  <input type="checkbox">
  <span class="slider round"></span>
</label>
</td>
    </tr>
    <tr>
        <td>2.</td>
        <td>Розетки</td>
        <td> 
<label class="switch">
  <input type="checkbox">
  <span class="slider round"></span>
</label> 
</td>
    </tr>
    <tr>
        <td>3.</td>
        <td>




</td>
        <td>Розетки: нет/ Свет: нет./Температура: нет.</td>
    </tr>

</body>  
</html>)rawliteral";


void setup(){

  // присваиваем статичесий IP адрес
       WiFi.mode(WIFI_STA); // режим клиента
       WiFi.config(IPAddress(192,168,1,222),IPAddress(192,168,1,1),IPAddress(255,255,255,0),IPAddress(192,168,1,1));
  Serial.begin(115200);
  delay(100);




  // Подключиться к Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }

  // Вывести локальный IP-адрес
  Serial.println(WiFi.localIP());

  // Маршрут для корня / веб-страницы

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/html", index_html);
  });

  // Запустить сервер
  server.begin();
}

void loop(){
}

Ответы (0 шт):