Тема: Умный дом
Основная статья - http://rcl-radio.ru/?p=67860
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <OneWire.h>//https://github.com/PaulStoffregen/OneWire/archive/master.zip
#include <DallasTemperature.h>
#include <EEPROM.h>
OneWire oneWire1(14);// D5 вход датчика 18b20
OneWire oneWire2(5); // D1 вход датчика 18b20
DallasTemperature temp1(&oneWire1);
DallasTemperature temp2(&oneWire2);
MDNSResponder mdns;
WiFiUDP ntpUDP;
// впишите сюда данные, соответствующие вашей сети:
const char* ssid = "Redmi Note 3";
const char* password = "32481975";
ESP8266WebServer server(80);
NTPClient timeClient(ntpUDP, "pool.ntp.org", 21600,3600123);
//unsigned long times;
String webPage = "",t,date_time,date;
int hh,mm,ss;
int time1_sum,time1of_sum,time2_sum,time2of_sum,time3_sum,time3of_sum,time4_sum,time4of_sum,time5_sum,time5of_sum;
int time_ds,temper1,temper2,reg_t1,reg_t2,gis=1,res=1000,list=1;
String d0="OFF",d1="OFF",d2="OFF",d3="OFF",d4="OFF",ind1,ind2;
int stop_d0,stop_d3,stop_d6,stop_d7,stop_d8;
int h1,m1,h1of,m1of,h2,m2,h2of,m2of,h3,m3,h3of,m3of,h4,m4,h4of,m4of,h5,m5,h5of,m5of;
int socket16,socket0,socket12,socket13,socket15;
void setup(void){
EEPROM.begin(512);
reg_t1=EEPROM.read(0);
socket16=EEPROM.read(1);socket0=EEPROM.read(2);socket12=EEPROM.read(3);socket13=EEPROM.read(4);socket15=EEPROM.read(5);
h1=EEPROM.read(10);m1=EEPROM.read(11);h1of=EEPROM.read(12);m1of=EEPROM.read(13);
h2=EEPROM.read(14);m2=EEPROM.read(15);h2of=EEPROM.read(16);m2of=EEPROM.read(17);
h3=EEPROM.read(18);m3=EEPROM.read(19);h3of=EEPROM.read(20);m3of=EEPROM.read(21);
h4=EEPROM.read(22);m4=EEPROM.read(23);h4of=EEPROM.read(24);m4of=EEPROM.read(25);
h5=EEPROM.read(26);m5=EEPROM.read(27);h5of=EEPROM.read(28);m5of=EEPROM.read(29);
res=EEPROM.read(30);reg_t2=EEPROM.read(31);
pinMode(16, OUTPUT);digitalWrite(16, LOW);
pinMode(0, OUTPUT);digitalWrite(0, LOW);
pinMode(12, OUTPUT);digitalWrite(12, LOW);
pinMode(13, OUTPUT);digitalWrite(13, LOW);
pinMode(15, OUTPUT);digitalWrite(15, LOW);
pinMode(4, OUTPUT);digitalWrite(4, LOW);
pinMode(2, OUTPUT);digitalWrite(2, LOW);
temp1.begin();temp1.setResolution(10);//10 бит
temp2.begin();temp2.setResolution(10);//10 бит
delay(1000);
Serial.begin(9600);
WiFi.begin(ssid, password);
Serial.println("");
while (WiFi.status() != WL_CONNECTED) {delay(500);Serial.print(".");}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
timeClient.begin();
if (mdns.begin("esp8266", WiFi.localIP())) {Serial.println("MDNS responder started");}
server.on("/", [](){;web();});
server.on("/temperatura", [](){list=1;web();});
server.on("/rele", [](){list=2;web();});
server.on("/rele_time", [](){list=3;web();});
server.on("/obn", [](){web();});
server.on("/restart_off", [](){res=1000;web();});
server.on("/restart_10_on", [](){res=10;web();});
server.on("/restart_30_on", [](){res=30;web();});
server.on("/restart_60_on", [](){res=60;web();});
server.on("/socket16On", [](){socket16=1;web();});
server.on("/socket16Off", [](){socket16=0;web();});
server.on("/socket0On", [](){socket0=1;web();});
server.on("/socket0Off", [](){socket0=0;web();});
server.on("/socket12On", [](){socket12=1;web();});
server.on("/socket12Off", [](){socket12=0;web();});
server.on("/socket13On", [](){socket13=1;web();});
server.on("/socket13Off", [](){socket13=0;web();});
server.on("/socket15On", [](){socket15=1;web();});
server.on("/socket15Off", [](){socket15=0;web();});
server.on("/eeprom", [](){EEPROM.begin(512);EEPROM.write(0,reg_t1);
EEPROM.write(1,socket16);EEPROM.write(2,socket0);EEPROM.write(3,socket12);EEPROM.write(4,socket13);EEPROM.write(5,socket15);
EEPROM.write(10,h1);EEPROM.write(11,m1);EEPROM.write(12,h1of);EEPROM.write(13,m1of);
EEPROM.write(14,h2);EEPROM.write(15,m2);EEPROM.write(16,h2of);EEPROM.write(17,m2of);
EEPROM.write(18,h3);EEPROM.write(19,m3);EEPROM.write(20,h3of);EEPROM.write(21,m3of);
EEPROM.write(22,h4);EEPROM.write(23,m4);EEPROM.write(24,h4of);EEPROM.write(25,m4of);
EEPROM.write(26,h5);EEPROM.write(27,m5);EEPROM.write(28,h5of);EEPROM.write(29,m5of);EEPROM.write(30,res);EEPROM.write(31,reg_t2);
EEPROM.commit();web();});
server.begin();
Serial.println("HTTP server started");
}
void loop(){ sumbit();
temp1.requestTemperatures();temper1=temp1.getTempCByIndex(0); // измерение температуры 18B20
temp2.requestTemperatures();temper2=temp2.getTempCByIndex(0); // измерение температуры 18B20
if(reg_t1 >= temper1 + gis){digitalWrite(2,HIGH);}
if(reg_t1 <= temper1 - gis){digitalWrite(2,LOW);}
if(reg_t2 >= temper2 + gis){digitalWrite(4,HIGH);}
if(reg_t2 <= temper2 - gis){digitalWrite(4,LOW);}
timeClient.update();
t = timeClient.getFormattedDate();
date_time = timeClient.getFormattedDate();
int index_date = date_time.indexOf("T");
date = date_time.substring(0, index_date);
hh = timeClient.getHours();
mm = timeClient.getMinutes();
ss = timeClient.getSeconds();
time_ds=hh*100+mm;// время как число
time1_sum=h1*100+m1;
time1of_sum=h1of*100+m1of;
time2_sum=h2*100+m2;
time2of_sum=h2of*100+m2of;
time3_sum=h3*100+m3;
time3of_sum=h3of*100+m3of;
time4_sum=h4*100+m4;
time4of_sum=h4of*100+m4of;
time5_sum=h5*100+m5;
time5of_sum=h5of*100+m5of;
if(time1_sum==time1of_sum){stop_d0=1;} else{stop_d0=0;if(time_ds>=time1_sum&&time_ds<time1of_sum){digitalWrite(16,HIGH);}else{digitalWrite(16,LOW);}}
if(time2_sum==time2of_sum){stop_d3=1;} else{stop_d3=0;if(time_ds>=time2_sum&&time_ds<time2of_sum){digitalWrite(0,HIGH);}else{digitalWrite(0,LOW);}}
if(time3_sum==time3of_sum){stop_d6=1;} else{stop_d6=0;if(time_ds>=time3_sum&&time_ds<time3of_sum){digitalWrite(12,HIGH);}else{digitalWrite(12,LOW);}}
if(time4_sum==time4of_sum){stop_d7=1;} else{stop_d7=0;if(time_ds>=time4_sum&&time_ds<time4of_sum){digitalWrite(13,HIGH);}else{digitalWrite(13,LOW);}}
if(time5_sum==time5of_sum){stop_d8=1;} else{stop_d8=0;if(time_ds>=time5_sum&&time_ds<time5of_sum){digitalWrite(15,HIGH);}else{digitalWrite(15,LOW);}}
if(socket16==1&&stop_d0==1){digitalWrite(16, HIGH);}if(socket16==0&&stop_d0==1){digitalWrite(16, LOW);}
if(socket0==1&&stop_d3==1){digitalWrite(0, HIGH);}if(socket0==0&&stop_d3==1){digitalWrite(0, LOW);}
if(socket12==1&&stop_d6==1){digitalWrite(12, HIGH);}if(socket12==0&&stop_d6==1){digitalWrite(12, LOW);}
if(socket13==1&&stop_d7==1){digitalWrite(13, HIGH);}if(socket13==0&&stop_d7==1){digitalWrite(13, LOW);}
if(socket15==1&&stop_d8==1){digitalWrite(15, HIGH);}if(socket15==0&&stop_d8==1){digitalWrite(15, LOW);}
server.handleClient();
}
void web(){sumbit();
String webPage = "<!DOCTYPE HTML><html>";
webPage += "<script src='//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>";
webPage += "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
webPage += "<meta http-equiv='Cache-Control' content='private'>";
if(list==1){
webPage += "<meta http-equiv='Refresh' content='";
webPage += res;
webPage += "; URL=/obn' />";}
//style
webPage += "<head><style>.tab1 {background-color:#F5F5F5;border-radius: 5px;margin: auto;}";
webPage += "#menu1{list-style:none; width:100%; padding:0 0 0 0 ; margin: 0 0 0 0;background: #999;}";
webPage += "#menu1 li{float:left; font:bold 14px Arial;text-shadow: 1px 1px 0px #000;}";
webPage += "#menu1 a{color:#fff; display:block; height:36px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
webPage += "#menu1 a:hover{color:#fff; background:#555;}";
webPage += "#menu1 b{color:#fff; display:block; height:25px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
webPage += "</style></head>";
// menu
webPage += "<table bgcolor='#4682B4' align='center' width='470' border='0' cellspacing='0' cellpadding='0' ><td>";
webPage += "<ul id='menu1'>";
webPage += "<li><a <a href=\"temperatura\">Терморегулятор</a></a></li>";
webPage += "<li><a href=\"rele\">Управление реле</a></li>";
webPage += "<li><a href=\"rele_time\">Реле времени</a></li>";
webPage += "<li><b>ESP8266</b></li>";
webPage += "</ul></td>";
webPage += "</table><br>";
// end nemu
if(list==1){ // temperatura
if(reg_t1<=0){reg_t1=0;}if(reg_t1>=125){reg_t1=125;}
if(reg_t1 >= temper1 + gis){ind1=" ВКЛ";}
if(reg_t1 <= temper1 - gis){ind1=" ВЫКЛ";}
if(reg_t2<=0){reg_t2=0;}if(reg_t2>=125){reg_t2=125;}
if(reg_t2 >= temper2 + gis){ind2=" ВКЛ";}
if(reg_t2<= temper2 - gis){ind2=" ВЫКЛ";}
///////////////// temp 1//////////////////////
webPage += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='5'><td colspan='3' align='center'>";
webPage += "<h1>Терморегулятор 0...125 °C</td><tr></h1>";
webPage += "<td align='center'>Температура 1</td><td align='center'><a href=\"obn\"><button>Обновить</button></a></td><td align='center'><b>";
webPage += temper1;
webPage += " °C</b></td><tr>";
webPage += "<td align='center'>Регулировка температуры</td>";
webPage +="<form action='' method='post'><td align='center'><input type='text' name='reg_t1' autocomplete='off' maxlength='3' size='1'></input> ";
webPage += "<a href=\"temperatura\"><button>Подтвердить</button></a></td></form>";
webPage +="<td align='center'><b>";
webPage += reg_t1;
webPage += " °C</b></td>";
webPage += "<tr><td colspan='3' align='center'>Нагрев: ";
webPage += ind1;
webPage += " D4 </td><tr>";
//////////////// temp 2 ////////////////////////
webPage += "<td align='center'>Температура 2</td><td align='center'><a href=\"obn\"><button>Обновить</button></a></td><td align='center'><b>";
webPage += temper2;
webPage += " °C</b></td><tr>";
webPage += "<td align='center'>Регулировка температуры</td>";
webPage +="<form action='' method='post'><td align='center'><input type='text' name='reg_t2' autocomplete='off' maxlength='3' size='1'></input> ";
webPage += "<a href=\"temperatura\"><button>Подтвердить</button></a></td></form>";
webPage +="<td align='center'><b>";
webPage += reg_t2;
webPage += " °C</b></td>";
webPage += "<tr><td colspan='3' align='center'>Нагрев: ";
webPage += ind2;
webPage += " D2 </td>";
webPage +="<tr><td colspan='3'> IP адрес: ";
webPage += WiFi.localIP().toString();
webPage +="<br> Сеть Wi-Fi: ";
webPage += ssid;
webPage += "<br> Уровень сигнала: ";
webPage += WiFi.RSSI();
webPage += " дБм<br>MAC адрес: ";
webPage += WiFi.macAddress();
webPage += "<br>";
webPage += "<tr><td colspan='3'>Время Интернет: ";
webPage += date + " " + hh/10+hh%10 + ":" + mm/10+mm%10 + ":" + ss/10+ss%10;
webPage += "</b></td><tr>";
webPage += "<tr><td colspan='3'>Время Сети: ";
webPage +="<script type='text/javascript'>window.onload = function(){(function(){var date = new Date();var time = date;document.getElementsByTagName('div')[0].innerHTML = time;window.setTimeout(arguments.callee, 1000);})();};</script><div></div>";
webPage += "</b></td><tr>";
webPage += "<td align='center' colspan='3'> Автообновление страницы <a href=\"restart_off\"><button> OFF </button></a> ";
webPage += " <a href=\"restart_10_on\"><button> 10 c </button></a> <a href=\"restart_30_on\"><button> 30 c</button></a> <a href=\"restart_60_on\"><button> 60 c </button></a> ";
if(res==1000){webPage += "OFF";}else{webPage += res;webPage += " c";}
webPage +="</td><tr>";
webPage += "<td align='center' colspan='3'> Cохранить настройки в энергонезависимую память: <a href=\"eeprom\"><button> YES </button></a></td> ";
webPage +="</table>";
}
if(list==2) { // rele
webPage += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='5'>";
webPage += "<td colspan='3' align='center'><h1>Управление реле</h1></td><tr>";
webPage += "<td align='center'>Номер реле (выхода)</td><td align='center'>Вкл/Выкл</td><td align='center'>Выход реле</td>";
webPage += "<tr><td align='center'>Реле 1 (D0)</td>";
if(stop_d0==1){
if(socket16==1){d0=" ON";}if(socket16==0){d0=" OFF";}
webPage += "<td align='center'><a href=\"socket16On\"><button>ON</button></a>";
webPage += "<a href=\"socket16Off\"><button>OFF</button></a></td>";}else{webPage += "<td align='center'>Реле времени</td>";d0="N/A";}
webPage += "<td align='center'>";
webPage += d0;
webPage += "</td><tr><td align='center'>Реле 2 (D3)</td>";
if(stop_d3==1){
if(socket0==1){d1=" ON";}if(socket0==0){d1=" OFF";}
webPage += "<td align='center'><a href=\"socket0On\"><button>ON</button></a>";
webPage += "<a href=\"socket0Off\"><button>OFF</button></a></td>";}else{webPage += "<td align='center'>Реле времени</td>";d1="N/A";}
webPage += "<td align='center'>";
webPage += d1;
webPage += "</td><tr><td align='center'>Реле 3 (D6)</td>";
if(stop_d6==1){
if(socket12==1){d2=" ON";}if(socket12==0){d2=" OFF";}
webPage += "<td align='center'><a href=\"socket12On\"><button>ON</button></a>";
webPage += "<a href=\"socket12Off\"><button>OFF</button></a></td>";}else{webPage += "<td align='center'>Реле времени</td>";d2="N/A";}
webPage += "<td align='center'>";
webPage += d2;
webPage += "</td><tr><td align='center'>Реле 4 (D7)</td>";
if(stop_d7==1){
if(socket13==1){d3=" ON";}if(socket13==0){d3=" OFF";}
webPage += "<td align='center'><a href=\"socket13On\"><button>ON</button></a>";
webPage += "<a href=\"socket13Off\"><button>OFF</button></a></td>";}else{webPage += "<td align='center'>Реле времени</td>";d3="N/A";}
webPage += "<td align='center'>";
webPage += d3;
webPage += "</td><tr><td align='center'>Реле 5 (D8)</td>";
if(stop_d8==1){
if(socket15==1){d4=" ON";}if(socket15==0){d4=" OFF";}
webPage += "<td align='center'><a href=\"socket15On\"><button>ON</button></a>";
webPage += "<a href=\"socket15Off\"><button>OFF</button></a></td>";}else{webPage += "<td align='center'>Реле времени</td>";d4="N/A";}
webPage += "<td align='center'>";
webPage += d4;
webPage +="</td><tr>";
webPage += "<td align='center' colspan='3'> Cохранить настройки в энергонезависимую память: <a href=\"eeprom\"><button> YES </button></a></td></table>";
}
if(list==3){ // rele time
webPage += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='3'>";
webPage += "<td colspan='3' align='center'><h3>Реле времени</h3>";
webPage +="<script type='text/javascript'>window.onload = function(){(function(){var date = new Date();var time = date;document.getElementsByTagName('div')[0].innerHTML = time;window.setTimeout(arguments.callee, 1000);})();};</script><div></div>";
webPage += "</td>";
// реле 1
webPage += "<form action='' method='post'>";
webPage += "<tr><td colspan='3' align='center'><b>Реле 1 (D0)";
if(hh*100+mm>=h1*100+m1&&hh*100+mm<h1of*100+m1of){webPage +=" ON";}
else if(h1*100+m1==h1of*100+m1of){webPage +=" N/A";}
else{webPage +=" OFF";}
webPage +="</b></td><tr>";
webPage += "<td> Время включения ";
if(h1<10){webPage += "0";}if(h1>23){h1=0;}webPage += h1;
webPage += ":";
if(m1<10){webPage += "0";}if(m1>59){m1=0;}webPage += m1;
webPage += "</td><td align='center'><input type='text' name='h1' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m1' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
webPage += "<form action='' method='post'>";
webPage += "<tr><td>Время выключения ";
if(h1of<10){webPage += "0";if(h1of>23){h1of=0;}}webPage += h1of;
webPage += ":";
if(m1of<10){webPage += "0";}if(m1of>59){m1of=0;}webPage += m1of;
webPage += "</td><td align='center'><input type='text' name='h1of' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m1of' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
// реле 2
webPage += "<form action='' method='post'>";
webPage += "<tr><td colspan='3' align='center'><b>Реле 2 (D3)";
if(hh*100+mm>=h2*100+m2&&hh*100+mm<h2of*100+m2of){webPage +=" ON";}
else if(h2*100+m2==h2of*100+m2of){webPage +=" N/A";}
else{webPage +=" OFF";}
webPage +="</b></td><tr>";
webPage += "<td> Время включения ";
if(h2<10){webPage += "0";}if(h2>23){h2=0;}webPage += h2;
webPage += ":";
if(m2<10){webPage += "0";}if(m2>59){m2=0;}webPage += m2;
webPage += "</td><td align='center'><input type='text' name='h2' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m2' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
webPage += "<form action='' method='post'>";
webPage += "<tr><td>Время выключения ";
if(h2of<10){webPage += "0";if(h2of>23){h2of=0;}}webPage += h2of;
webPage += ":";
if(m2of<10){webPage += "0";}if(m2of>59){m2of=0;}webPage += m2of;
webPage += "</td><td align='center'><input type='text' name='h2of' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m2of' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
// реле 3
webPage += "<form action='' method='post'>";
webPage += "<tr><td colspan='3' align='center'><b>Реле 3 (D6)";
if(hh*100+mm>=h3*100+m3&&hh*100+mm<h3of*100+m3of){webPage +=" ON";}
else if(h3*100+m3==h3of*100+m3of){webPage +=" N/A";}
else{webPage +=" OFF";}
webPage +="</b></td><tr>";
webPage += "<td> Время включения ";
if(h3<10){webPage += "0";}if(h3>23){h3=0;}webPage += h3;
webPage += ":";
if(m3<10){webPage += "0";}if(m3>59){m3=0;}webPage += m3;
webPage += "</td><td align='center'><input type='text' name='h3' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m3' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
webPage += "<form action='' method='post'>";
webPage += "<tr><td>Время выключения ";
if(h3of<10){webPage += "0";if(h3of>23){h3of=0;}}webPage += h3of;
webPage += ":";
if(m3of<10){webPage += "0";}if(m3of>59){m3of=0;}webPage += m3of;
webPage += "</td><td align='center'><input type='text' name='h3of' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m3of' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
// реле 4
webPage += "<form action='' method='post'>";
webPage += "<tr><td colspan='3' align='center'><b>Реле 4 (D7)";
if(hh*100+mm>=h4*100+m4&&hh*100+mm<h4of*100+m4of){webPage +=" ON";}
else if(h4*100+m4==h4of*100+m4of){webPage +=" N/A";}
else{webPage +=" OFF";}
webPage +="</b></td><tr>";
webPage += "<td> Время включения ";
if(h4<10){webPage += "0";}if(h4>23){h4=0;}webPage += h4;
webPage += ":";
if(m4<10){webPage += "0";}if(m4>59){m4=0;}webPage += m4;
webPage += "</td><td align='center'><input type='text' name='h4' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m4' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
webPage += "<form action='' method='post'>";
webPage += "<tr><td>Время выключения ";
if(h4of<10){webPage += "0";if(h4of>23){h4of=0;}}webPage += h4of;
webPage += ":";
if(m4of<10){webPage += "0";}if(m4of>59){m4of=0;}webPage += m4of;
webPage += "</td><td align='center'><input type='text' name='h4of' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m4of' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
// реле 5
webPage += "<form action='' method='post'>";
webPage += "<tr><td colspan='3' align='center'><b>Реле 5 (D8)";
if(hh*100+mm>=h5*100+m5&&hh*100+mm<h5of*100+m2of){webPage +=" ON";}
else if(h5*100+m5==h5of*100+m5of){webPage +=" N/A";}
else{webPage +=" OFF";}
webPage +="</b></td><tr>";
webPage += "<td> Время включения ";
if(h5<10){webPage += "0";}if(h5>23){h5=0;}webPage += h5;
webPage += ":";
if(m5<10){webPage += "0";}if(m5>59){m5=0;}webPage += m5;
webPage += "</td><td align='center'><input type='text' name='h5' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m5' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
webPage += "<form action='' method='post'>";
webPage += "<tr><td>Время выключения ";
if(h5of<10){webPage += "0";if(h5of>23){h5of=0;}}webPage += h5of;
webPage += ":";
if(m5of<10){webPage += "0";}if(m5of>59){m5of=0;}webPage += m5of;
webPage += "</td><td align='center'><input type='text' name='h5of' autocomplete='off' maxlength='2' size='1'></input>:";
webPage += "<input type='text' name='m5of' autocomplete='off' maxlength='2' size='1'> </input> ";
webPage += "</td><td align='center'><a href=\"obn\"><button type='submit'>Подтвердить</button></a></td>";
webPage +="</form>";
webPage += "<tr><td align='center' colspan='3'><a href=\"obn\"><button>Обновить</button></a><tr>";
webPage += "<td align='center' colspan='3'> Cохранить настройки в энергонезависимую память: <a href=\"eeprom\"><button> YES </button></a></td> ";
webPage +="</td></table></html>";
}
server.send(200, "text/html", webPage);
// end style
}
void sumbit(){
if (server.args() > 0 ) {
for ( uint8_t i = 0; i < server.args(); i++ ) {
if (server.argName(i) == "h1"){h1 = server.arg(i).toInt();}
if (server.argName(i) == "m1"){m1 = server.arg(i).toInt();}
if (server.argName(i) == "h1of"){h1of = server.arg(i).toInt();}
if (server.argName(i) == "m1of"){m1of = server.arg(i).toInt();}
if (server.argName(i) == "h2"){h2 = server.arg(i).toInt();}
if (server.argName(i) == "m2"){m2 = server.arg(i).toInt();}
if (server.argName(i) == "h2of"){h2of = server.arg(i).toInt();}
if (server.argName(i) == "m2of"){m2of = server.arg(i).toInt();}
if (server.argName(i) == "h3"){h3 = server.arg(i).toInt();}
if (server.argName(i) == "m3"){m3 = server.arg(i).toInt();}
if (server.argName(i) == "h3of"){h3of = server.arg(i).toInt();}
if (server.argName(i) == "m3of"){m3of = server.arg(i).toInt();}
if (server.argName(i) == "h4"){h4 = server.arg(i).toInt();}
if (server.argName(i) == "m4"){m4 = server.arg(i).toInt();}
if (server.argName(i) == "h4of"){h4of = server.arg(i).toInt();}
if (server.argName(i) == "m4of"){m4of = server.arg(i).toInt();}
if (server.argName(i) == "h5"){h5 = server.arg(i).toInt();}
if (server.argName(i) == "m5"){m5 = server.arg(i).toInt();}
if (server.argName(i) == "h5of"){h5of = server.arg(i).toInt();}
if (server.argName(i) == "m5of"){m5of = server.arg(i).toInt();}
if (server.argName(i) == "reg_t1"){reg_t1 = server.arg(i).toInt();}
if (server.argName(i) == "reg_t2"){reg_t2 = server.arg(i).toInt();}
}}
}