1

Тема: ESP8266+WS2811 = часы

Основная статья http://rcl-radio.ru/?p=91626

http://forum.rcl-radio.ru/uploads/images/2020/12/39be3e2696b52be2ee9888759e90260d.png

http://forum.rcl-radio.ru/uploads/images/2020/12/66edf9b8bff371dc40730dea592c7771.png

http://forum.rcl-radio.ru/uploads/images/2020/12/3be2f93644b154af150d4cb5da050408.png

Данный контент доступен только зарегистрированным пользователям.


SM16703
http://forum.rcl-radio.ru/uploads/images/2020/12/10d548f86e3e76f12f77e5ecb9f125a2.png

http://forum.rcl-radio.ru/uploads/images/2020/12/62151f111d015b015ad2e86c7378397e.png

Данный контент доступен только зарегистрированным пользователям.

#include <NTPClient.h>
#include <ESP8266WiFi.h> 
#include <WiFiUdp.h> 
#include <Wire.h> 
#include <Adafruit_NeoPixel.h>
 WiFiUDP ntpUDP;
      /////////////////  https://www.ntppool.org/zone/@ - другие сервера  /////////////////////////////
      ///////////////// для России - ru.pool.ntp.org //////////////////////////////////////////////////
 NTPClient timeClient(ntpUDP, "pool.ntp.org", 21600,3600123);// 21600 - временной сдвиг в секундах от UTC 
 Adafruit_NeoPixel strip = Adafruit_NeoPixel(45, D6, NEO_GRB + NEO_KHZ400);//  трек, D6  
 const char *ssid = "Redmi Note 3"; 
 const char *password = "32481975";
 String date_time,date;
 unsigned long times;
 int ss,mm,hh,dd,mon,yer,brignes = 250;
 int hear10,hear0,min10,min0,sec10,sec0;
 
void setup(){
  Serial.begin(9600);strip.begin();
  WiFi.begin(ssid, password);
  while ( WiFi.status() != WL_CONNECTED ){delay (500);Serial.print (".");timeClient.begin();}
  Serial.print("ok");
}
 
void loop(){
  
  //// Time //////////////////////////////////////////
  if(millis()-times>=1000){times=millis();
   while(!timeClient.update()){timeClient.forceUpdate();}
   hh = timeClient.getHours();
   mm = timeClient.getMinutes();
   ss = timeClient.getSeconds();
  date_time = timeClient.getFormattedDate();
  int index_date = date_time.indexOf("T");
  date = date_time.substring(0, index_date);
  char charBufVar[11];date.toCharArray(charBufVar, 11);
   dd = int(charBufVar[0]-'0')*10+int(charBufVar[1]-'0');
   mon = int(charBufVar[3]-'0')*10+int(charBufVar[4]-'0');
   yer = int(charBufVar[8]-'0')*10+int(charBufVar[9]-'0');
  Serial.println(dd);
  Serial.println(mon);
  Serial.println(yer);
  }
  //// ws2812 /////////////////////////////////////////

 if(ss>10&&ss<15){hear10=dd/10;hear0=dd%10;min10=mon/10;min0=mon%10;sec10=yer/10;sec0=yer%10;}
  else{hear10=hh/10;hear0=hh%10;min10=mm/10;min0=mm%10;sec10=ss/10;sec0=ss%10;}
  
  switch(hear10){   
    case 0: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);break;
    case 1: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 2: ws(0,1);ws(1,2);ws(2,0);ws(3,1);ws(4,1);ws(5,0);ws(6,1);break;
    case 3: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,0);ws(6,1);break;
    case 4: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;
    case 5: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
    case 6: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 7: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 8: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 9: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
   case 10: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;// " "
   case 11: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "t"
   case 12: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "P"
   case 13: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "H"
   case 14: ws(0,1);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "C"
   case 15: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;// градус
    }
   switch(hear0){   
    case 0: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,0);break;
    case 1: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 2: ws(7,1);ws(8,2);ws(9,0);ws(10,1);ws(11,1);ws(12,0);ws(13,1);break;
    case 3: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,0);ws(13,1);break;
    case 4: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;
    case 5: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
    case 6: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 7: ws(7,1);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 8: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 9: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
   case 10: ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;// " "
   case 11: ws(7,0);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "t"
   case 12: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "P"
   case 13: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "H"
   case 14: ws(7,1);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "C"
   case 15: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;// градус   
    } 
     
    strip.setPixelColor(14, strip.Color(brignes, brignes, brignes));
    strip.setPixelColor(15, strip.Color(brignes, brignes, brignes));
    
   switch(min10){   
    case 0: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,0);break;
    case 1: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;
    case 2: ws(16,1);ws(17,2);ws(18,0);ws(19,1);ws(20,1);ws(21,0);ws(22,1);break;
    case 3: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,0);ws(22,1);break;
    case 4: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;
    case 5: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
    case 6: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 7: ws(16,1);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;
    case 8: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 9: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
   case 10: ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;// " " 
   case 11: ws(16,0);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "t" 
   case 12: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "P"
   case 13: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "H"
   case 14: ws(16,1);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "C"
   case 15: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;// градус  
    }
   switch(min0){   
    case 0: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,0);break;
    case 1: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 2: ws(23,1);ws(24,2);ws(25,0);ws(26,1);ws(27,1);ws(28,0);ws(29,1);break;
    case 3: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,1);break;
    case 4: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;
    case 5: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
    case 6: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 7: ws(23,1);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 8: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 9: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
   case 10: ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;// " " 
   case 11: ws(23,0);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "t" 
   case 12: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "P"
   case 13: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "H"
   case 14: ws(23,1);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "C"
   case 15: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;// градус  
    } 

    strip.setPixelColor(30, strip.Color(brignes, brignes, brignes));

   switch(sec10){   
    case 0: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,0);break;
    case 1: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 2: ws(31,1);ws(32,2);ws(33,0);ws(34,1);ws(35,1);ws(36,0);ws(37,1);break;
    case 3: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,0);ws(37,1);break;
    case 4: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;
    case 5: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
    case 6: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 7: ws(31,1);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 8: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 9: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
   case 10: ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;// " " 
   case 11: ws(31,0);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "t" 
   case 12: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "P"
   case 13: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "H"
   case 14: ws(31,1);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "C"
   case 15: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;// градус    
    }
   switch(sec0){   
    case 0: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,0);break;
    case 1: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 2: ws(38,1);ws(39,2);ws(40,0);ws(41,1);ws(42,1);ws(43,0);ws(44,1);break;
    case 3: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,0);ws(44,1);break;
    case 4: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;
    case 5: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
    case 6: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 7: ws(38,1);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 8: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 9: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
   case 10: ws(38,0);ws(39,0);ws(40,0);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;// " " 
   case 11: ws(38,0);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "t" 
   case 12: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "P"
   case 13: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "H"
   case 14: ws(38,1);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "C"
   case 15: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;// градус    
    } 
  strip.show();
  delay(100);
  }

 void ws(int ind, bool datt){
  if(datt==1){strip.setPixelColor(ind, strip.Color(brignes, brignes, brignes));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  } 

2

Re: ESP8266+WS2811 = часы

Данный контент доступен только зарегистрированным пользователям. Данный контент доступен только зарегистрированным пользователям. Данный контент доступен только зарегистрированным пользователям.

3

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/5f43f12ebd5454a17cc78cb11bd752fc.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/a38fca49afd1923930264f1be1c1417d.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/9b749501602e6e8668716e757e350165.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/c607ab996fd0c890fbf9b5c959b72b29.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/cf9dd3f53ea4de14f2d674f5e7a68247.jpg

4

Re: ESP8266+WS2811 = часы

тест 12 часов
http://forum.rcl-radio.ru/uploads/images/2020/12/386a44a4472eac73e555d6bdf5cf0f23.jpg

5

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/84fc41c3842ca7358a790f5cd22c5a7c.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/b984f57fece5679fcce5863cab3a83aa.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/9ecda9b52e9145b83ddcc6caa454127f.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/cbc22c95ed5acd9521b1a9222782a20a.jpg

6

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/06920cd0f13404482ba942075c4b1866.jpg
http://forum.rcl-radio.ru/uploads/images/2020/12/676546606ee79efb5c0f0c95834f7e0f.jpg
http://forum.rcl-radio.ru/uploads/images/2020/12/dd2020b816115ac4fa2d67ffa7e87132.jpg

7

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/0add8deccb01cab62f39ad860f01e738.jpg

8

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/fab2409d43c507cf5574ab04d2278e74.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/152e6852a8a4f8fc7955887afcbd31c5.jpg

9

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/f965e66d6f7ff9795007123c797e4411.jpg
18 Часов
http://forum.rcl-radio.ru/uploads/images/2020/12/e2bd262dc8451618e3d0e3e480d68221.jpg
23 Число

10

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/ddbf07d30798572700b979b509c088b3.jpg

11

Re: ESP8266+WS2811 = часы

#include <NTPClient.h>
#include <ESP8266WiFi.h> 
#include <WiFiUdp.h> 
#include <Wire.h> 
#include <Adafruit_NeoPixel.h>
 WiFiUDP ntpUDP;
      /////////////////  https://www.ntppool.org/zone/@ - другие сервера  /////////////////////////////
      ///////////////// для России - ru.pool.ntp.org //////////////////////////////////////////////////
 NTPClient timeClient(ntpUDP, "pool.ntp.org", 21600,3600123);// 21600 - временной сдвиг в секундах от UTC 
 Adafruit_NeoPixel strip = Adafruit_NeoPixel(45, D6, NEO_GRB + NEO_KHZ400);//  трек, D6  
 const char *ssid = "Keenetic-9009"; 
 const char *password = "32481975";
 String date_time,date;
 unsigned long times,times1;
 int ss,mm,hh,dd,mon,yer,brignes = 250;
 int hear10,hear0,min10,min0,sec10,sec0;
 int hhh,ss_old;
 
void setup(){
  Serial.begin(9600);strip.begin();
  WiFi.begin(ssid, password);
  while ( WiFi.status() != WL_CONNECTED ){delay (500);Serial.print (".");timeClient.begin();}
  Serial.print("ok");
  pinMode(2, OUTPUT);
}
 
void loop(){
  
  //// Time //////////////////////////////////////////
  if(millis()-times>=1000){times=millis();
   while(!timeClient.update()){timeClient.forceUpdate();}
   hh = timeClient.getHours();
   mm = timeClient.getMinutes();
   ss = timeClient.getSeconds();
  date_time = timeClient.getFormattedDate();
  int index_date = date_time.indexOf("T");
  date = date_time.substring(0, index_date);
  char charBufVar[11];date.toCharArray(charBufVar, 11);
   dd = int(charBufVar[0]-'0')*10+int(charBufVar[1]-'0');
   mon = int(charBufVar[3]-'0')*10+int(charBufVar[4]-'0');
   yer = int(charBufVar[8]-'0')*10+int(charBufVar[9]-'0');
  }
  //// ws2812 /////////////////////////////////////////

 if(ss>10&&ss<15){hear10=dd/10;hear0=dd%10;min10=mon/10;min0=mon%10;sec10=yer/10;sec0=yer%10;hhh=1;}
  else{hear10=hh/10;hear0=hh%10;min10=mm/10;min0=mm%10;sec10=ss/10;sec0=ss%10;hhh=0;}
 
  
  switch(hear10){   
    case 0: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);break;
    case 1: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 2: ws(0,1);ws(1,2);ws(2,0);ws(3,1);ws(4,1);ws(5,0);ws(6,1);break;
    case 3: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,0);ws(6,1);break;
    case 4: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;
    case 5: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
    case 6: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 7: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 8: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 9: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
   case 10: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;// " "
   case 11: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "t"
   case 12: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "P"
   case 13: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "H"
   case 14: ws(0,1);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "C"
   case 15: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;// градус
    }
   switch(hear0){   
    case 0: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,0);break;
    case 1: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 2: ws(7,1);ws(8,2);ws(9,0);ws(10,1);ws(11,1);ws(12,0);ws(13,1);break;
    case 3: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,0);ws(13,1);break;
    case 4: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;
    case 5: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
    case 6: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 7: ws(7,1);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 8: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 9: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
   case 10: ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;// " "
   case 11: ws(7,0);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "t"
   case 12: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "P"
   case 13: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "H"
   case 14: ws(7,1);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "C"
   case 15: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;// градус   
    } 

/// двоеточние и запятая
   if(hhh==0){
   if(ss!=ss_old){times1=millis();}  
   if(millis()-times1<500){ws(14,1);ws(15,1);ws(30,1); digitalWrite(2, HIGH);}
   else{ws(14,0);ws(15,0);ws(30,0); digitalWrite(2, LOW);}
   ss_old=ss;}

   if(hhh==1){ws(14,1);ws(15,0);ws(30,1); digitalWrite(2, LOW);}
    
   switch(min10){   
    case 0: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,0);break;
    case 1: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;    
    case 2: ws(16,1);ws(17,2);ws(18,0);ws(19,1);ws(20,1);ws(21,0);ws(22,1);break;
    case 3: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,0);ws(22,1);break;
    case 4: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;
    case 5: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
    case 6: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 7: ws(16,1);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;
    case 8: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 9: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
   case 10: ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;// " " 
   case 11: ws(16,0);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "t" 
   case 12: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "P"
   case 13: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "H"
   case 14: ws(16,1);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "C"
   case 15: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;// градус  
    }
   switch(min0){   
    case 0: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,0);break;
    case 1: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 2: ws(23,1);ws(24,2);ws(25,0);ws(26,1);ws(27,1);ws(28,0);ws(29,1);break;
    case 3: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,1);break;
    case 4: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;
    case 5: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
    case 6: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 7: ws(23,1);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 8: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 9: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
   case 10: ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;// " " 
   case 11: ws(23,0);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "t" 
   case 12: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "P"
   case 13: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "H"
   case 14: ws(23,1);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "C"
   case 15: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;// градус  
    } 

    

   switch(sec10){   
    case 0: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,0);break;
    case 1: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 2: ws(31,1);ws(32,2);ws(33,0);ws(34,1);ws(35,1);ws(36,0);ws(37,1);break;
    case 3: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,0);ws(37,1);break;
    case 4: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;
    case 5: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
    case 6: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 7: ws(31,1);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 8: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 9: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
   case 10: ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;// " " 
   case 11: ws(31,0);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "t" 
   case 12: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "P"
   case 13: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "H"
   case 14: ws(31,1);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "C"
   case 15: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;// градус    
    }
   switch(sec0){   
    case 0: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,0);break;
    case 1: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 2: ws(38,1);ws(39,2);ws(40,0);ws(41,1);ws(42,1);ws(43,0);ws(44,1);break;
    case 3: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,0);ws(44,1);break;
    case 4: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;
    case 5: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
    case 6: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 7: ws(38,1);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 8: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 9: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
   case 10: ws(38,0);ws(39,0);ws(40,0);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;// " " 
   case 11: ws(38,0);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "t" 
   case 12: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "P"
   case 13: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "H"
   case 14: ws(38,1);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "C"
   case 15: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;// градус    
    } 
  strip.show();
  delay(100);
  }

 void ws(int ind, bool datt){
  if(datt==1){strip.setPixelColor(ind, strip.Color(brignes, brignes, brignes));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }

12

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2020/12/9ba6659469c653f6388d0a25ef06e637.jpg http://forum.rcl-radio.ru/uploads/images/2020/12/99a3ca75921e8bd80f6f136096f00d8a.jpg

13

Re: ESP8266+WS2811 = часы

#include <NTPClient.h>
#include <ESP8266WiFi.h> 
#include <WiFiUdp.h> 
#include <Wire.h> 
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>
#ifndef APSSID
#define APSSID "ESPap"
#define APPSK  "12345678"
#endif
const char *ssid = APSSID;
const char *password = APPSK;
 ESP8266WebServer server(80);
 WiFiUDP ntpUDP;
 Adafruit_NeoPixel strip = Adafruit_NeoPixel(45, D6, NEO_GRB + NEO_KHZ400);//  трек, D6  
 NTPClient timeClient(ntpUDP, "pool.ntp.org", 0,3600123);
 String date_time,date;
 unsigned long times,times1;
 int ss,mm,hh,dd,mon,yer;
 int hear10,hear0,min10,min0,sec10,sec0;
 int hhh,ss_old;
 int brignes,utc;
 int r,g,b,cv,cv1;
 byte len_ssid, len_pass;

 
 
void setup(){
  delay(1000);timeClient.begin();
  EEPROM.begin(512);
  len_ssid = EEPROM.read(96);
  len_pass = EEPROM.read(97);
 if(len_pass > 64) len_pass = 0;

  brignes = EEPROM.read(200);
  utc = EEPROM.read(201);
  cv = EEPROM.read(202);
  cv1 = EEPROM.read(203);
  if(brignes<10||brignes>255){brignes=10;}
  timeClient.setTimeOffset(utc*1800);
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(5,INPUT_PULLUP);// D1

 /// точка доступа
  if(digitalRead(5)==LOW){
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/ok", handleOk);
  server.begin();
  Serial.println("HTTP server started");  
  }
  else{
        // Режим STATION
      WiFi.mode( WIFI_STA);
      unsigned char* buf_ssid = new unsigned char[32];
      unsigned char* buf_pass = new unsigned char[64];
      for(byte i = 0; i < len_ssid; i++) buf_ssid[i] = char(EEPROM.read(i));
      buf_ssid[len_ssid] = '\x0';
      const char *ssid  = (const char*)buf_ssid;
      for(byte i = 0; i < len_pass; i++) buf_pass[i] = char(EEPROM.read(i + 32));
      const char *pass  = (const char*)buf_pass;
      buf_pass[len_pass] = '\x0';
      delay(2000);
      Serial.print("SSID: ");
      Serial.print(ssid);
      Serial.print("   ");
      Serial.print("Password: ");
      Serial.println(pass);
       
     WiFi.begin(ssid, pass);
      // Wait for connection
      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());
      server.on("/", web);
      server.on("/reset", web0);
      server.begin();
      Serial.println(brignes);
      Serial.println(utc);
      Serial.println(cv);
      Serial.println(cv1);
    }
  strip.begin();
}
 
void loop(){
  server.handleClient();

  if(digitalRead(5)==HIGH){
  //// Time //////////////////////////////////////////
  if(millis()-times>=1000){times=millis();
   while(!timeClient.update()){timeClient.forceUpdate();}
   hh = timeClient.getHours();
   mm = timeClient.getMinutes();
   ss = timeClient.getSeconds();
  date_time = timeClient.getFormattedDate();
  int index_date = date_time.indexOf("T");
  date = date_time.substring(0, index_date);
  char charBufVar[11];date.toCharArray(charBufVar, 11);
   dd = int(charBufVar[0]-'0')*10+int(charBufVar[1]-'0');
   mon = int(charBufVar[3]-'0')*10+int(charBufVar[4]-'0');
   yer = int(charBufVar[8]-'0')*10+int(charBufVar[9]-'0');
  }
  Serial.print(hh/10);Serial.print(hh%10);Serial.print(":");Serial.print(mm/10);Serial.print(mm%10);Serial.print(":");Serial.print(ss/10);Serial.println(ss%10);
  //// ws2812 /////////////////////////////////////////

 if(ss>10&&ss<15){hear10=dd/10;hear0=dd%10;min10=mon/10;min0=mon%10;sec10=yer/10;sec0=yer%10;hhh=1;}
  else{hear10=hh/10;hear0=hh%10;min10=mm/10;min0=mm%10;sec10=ss/10;sec0=ss%10;hhh=0;}
 
  
  switch(hear10){   
    case 0: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);break;
    case 1: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 2: ws(0,1);ws(1,2);ws(2,0);ws(3,1);ws(4,1);ws(5,0);ws(6,1);break;
    case 3: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,0);ws(6,1);break;
    case 4: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;
    case 5: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
    case 6: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 7: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 8: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 9: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
   case 10: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;// " "
   case 11: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "t"
   case 12: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "P"
   case 13: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "H"
   case 14: ws(0,1);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "C"
   case 15: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;// градус
    }
   switch(hear0){   
    case 0: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,0);break;
    case 1: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 2: ws(7,1);ws(8,2);ws(9,0);ws(10,1);ws(11,1);ws(12,0);ws(13,1);break;
    case 3: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,0);ws(13,1);break;
    case 4: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;
    case 5: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
    case 6: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 7: ws(7,1);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 8: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 9: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
   case 10: ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;// " "
   case 11: ws(7,0);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "t"
   case 12: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "P"
   case 13: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "H"
   case 14: ws(7,1);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "C"
   case 15: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;// градус   
    } 

/// двоеточние и запятая
   if(hhh==0){
   if(ss!=ss_old){times1=millis();}  
   if(millis()-times1<500){ws1(14,1);ws1(15,1);ws1(30,1); digitalWrite(2, HIGH);}
   else{ws1(14,0);ws1(15,0);ws1(30,0); digitalWrite(2, LOW);}
   ss_old=ss;}

   if(hhh==1){ws1(14,1);ws1(15,0);ws1(30,1); digitalWrite(2, LOW);}
    
   switch(min10){   
    case 0: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,0);break;
    case 1: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;    
    case 2: ws(16,1);ws(17,2);ws(18,0);ws(19,1);ws(20,1);ws(21,0);ws(22,1);break;
    case 3: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,0);ws(22,1);break;
    case 4: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;
    case 5: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
    case 6: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 7: ws(16,1);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;
    case 8: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 9: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
   case 10: ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;// " " 
   case 11: ws(16,0);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "t" 
   case 12: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "P"
   case 13: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "H"
   case 14: ws(16,1);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "C"
   case 15: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;// градус  
    }
   switch(min0){   
    case 0: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,0);break;
    case 1: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 2: ws(23,1);ws(24,2);ws(25,0);ws(26,1);ws(27,1);ws(28,0);ws(29,1);break;
    case 3: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,1);break;
    case 4: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;
    case 5: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
    case 6: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 7: ws(23,1);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 8: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 9: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
   case 10: ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;// " " 
   case 11: ws(23,0);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "t" 
   case 12: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "P"
   case 13: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "H"
   case 14: ws(23,1);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "C"
   case 15: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;// градус  
    } 

    

   switch(sec10){   
    case 0: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,0);break;
    case 1: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 2: ws(31,1);ws(32,2);ws(33,0);ws(34,1);ws(35,1);ws(36,0);ws(37,1);break;
    case 3: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,0);ws(37,1);break;
    case 4: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;
    case 5: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
    case 6: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 7: ws(31,1);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 8: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 9: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
   case 10: ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;// " " 
   case 11: ws(31,0);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "t" 
   case 12: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "P"
   case 13: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "H"
   case 14: ws(31,1);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "C"
   case 15: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;// градус    
    }
   switch(sec0){   
    case 0: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,0);break;
    case 1: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 2: ws(38,1);ws(39,2);ws(40,0);ws(41,1);ws(42,1);ws(43,0);ws(44,1);break;
    case 3: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,0);ws(44,1);break;
    case 4: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;
    case 5: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
    case 6: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 7: ws(38,1);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 8: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 9: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
   case 10: ws(38,0);ws(39,0);ws(40,0);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;// " " 
   case 11: ws(38,0);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "t" 
   case 12: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "P"
   case 13: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "H"
   case 14: ws(38,1);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "C"
   case 15: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;// градус    
    } 
  strip.show();
  }
  delay(100);
  }

void ws(int ind, bool datt){
  if(cv==1){r=brignes;g=0;b=0;}
  if(cv==2){r=0;g=brignes;b=0;}
  if(cv==3){r=0;g=0;b=brignes;}
  if(cv==0){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(r, g, b));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }
void ws1(int ind, bool datt){
  if(cv1==1){r=brignes;g=0;b=0;}
  if(cv1==2){r=0;g=brignes;b=0;}
  if(cv1==3){r=0;g=0;b=brignes;}
  if(cv1==0){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(r, g, b));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }  

void web(){ 
   String webPage = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
   //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>";
    /////////////   
          webPage += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='10'>";
          webPage +="<td><h1><center>ESP8266<br>Страница настройки Интернет часов</h1>";
          webPage +="<tr><td><center><big>Текущее время: ";
          webPage += hh/10;webPage += hh%10; webPage +=":";webPage +=mm/10;
          webPage += mm%10; webPage +=":";webPage +=ss/10;webPage += ss%10;
          webPage += "</center>";
          webPage += "<form method='POST' action='reset' >";
          webPage += "<tr><td><input name='brignes'  autocomplete='off' maxlength='3' size='1'> Яркость 10...255 ";
          webPage += "<br>Установлено: ";webPage += brignes;
          webPage += "<tr><td><input name='time_utc'  autocomplete='off' maxlength='3' size='1'> Временной сдвиг UTC (30 мин)";
          webPage += "<br>Установлено: ";webPage += utc;
          webPage += " (";webPage += utc*0.5;webPage += " ч.)";
          
          webPage += "<tr><td><input name='cv'  autocomplete='off' maxlength='3' size='1'> Цвет цифр 0...3";
          webPage += "<br>0 - белый, 1 - красный, 2 - зеленый, 3 - синий";
          webPage += "<br>Установлено: ";webPage += cv;

          webPage += "<tr><td><input name='cv1'  autocomplete='off' maxlength='3' size='1'> Цвет двоеточия и запятой 0...3";
          webPage += "<br>0 - белый, 1 - красный, 2 - зеленый, 3 - синий";
          webPage += "<br>Установлено: ";webPage += cv1;
 
          webPage += "<tr><td><center><input type=SUBMIT value='Сохранить настройки'>";
          webPage += "</form>";
          webPage += "<center><br>Заполните все ячейки формы, незаполненная ячейка формы будет сохранена как 0";
   server.send(200, "text/html", webPage);//sumbit();
}

void sumbit(){ 
    if (server.args() > 0 ) {
    for ( uint8_t i = 0; i < server.args(); i++ ) {
      if (server.argName(i) == "brignes"){brignes = server.arg(i).toInt();}
      if (server.argName(i) == "time_utc"){utc = server.arg(i).toInt();}
      if (server.argName(i) == "cv"){cv = server.arg(i).toInt();}
      if (server.argName(i) == "cv1"){cv1 = server.arg(i).toInt();}
      }
      Serial.println("Save");
      Serial.println(brignes);
      Serial.println(utc);
      Serial.println(cv);
      Serial.println(cv1);
      EEPROM.begin(512);
      EEPROM.write(200,brignes);
      EEPROM.write(201,utc);
      EEPROM.write(202,cv);
      EEPROM.write(203,cv1);
      EEPROM.commit();
      delay(1000);ESP.restart();
      }}

void handleRoot() { 
   String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
   //style
          str += "<head><style>.tab1 {background-color:#F5F5F5;border-radius: 5px;margin: auto;}";
          str += "#menu1{list-style:none; width:100%; padding:0 0 0 0 ; margin: 0 0 0 0;background: #999;}";
          str += "#menu1 li{float:left; font:bold 14px Arial;text-shadow: 1px 1px 0px #000;}";
          str += "#menu1 a{color:#fff; display:block; height:36px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "#menu1 a:hover{color:#fff; background:#555;}";
          str += "#menu1 b{color:#fff; display:block; height:25px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "</style></head>";
   ////////////       
          str += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='10'>";
          str +="<td><h1><center>ESP8266<br>Авторизация</h1>";
          str += "<form method='POST' action='ok'>";
          str += "<tr><td><input name='ssid'  autocomplete='off'><big> Имя Wi-Fi сети";
          str += "<tr><td><input name='pswd'  autocomplete='off'><big> Пароль";
          str += "<tr><td><center><input type=SUBMIT value='Сохранить настройки'>";
          str += "</form>";
server.send ( 200, "text/html", str );
}      

void handleOk(){
  String ssid_ap;
  String pass_ap;
  unsigned char* buf = new unsigned char[64];
 
  String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";;
  str += "<body>";
 
  EEPROM.begin(512);
 
  ssid_ap = server.arg(0);
  pass_ap = server.arg(1);
 
  if(ssid_ap != ""){
    EEPROM.write(96,ssid_ap.length());
    EEPROM.write(97,pass_ap.length());
    ssid_ap.getBytes(buf, ssid_ap.length() + 1);
    for(byte i = 0; i < ssid_ap.length(); i++)
      EEPROM.write(i, buf[i]);
      
    pass_ap.getBytes(buf, pass_ap.length() + 1);
    for(byte i = 0; i < pass_ap.length(); i++)
      EEPROM.write(i + 32, buf[i]);
      
    EEPROM.commit();
    EEPROM.end();
   
    str +="<big><center>Конфигурация сохранена в память</br>\
   <big><center>Уберите перемычку с D1 и перезагрузите ESP8266</p></br></br>\
   <a href=\"/\">Return</a> to settings page</br>";
  }
  else {
    str += "<big><center>No WIFI Net</br>\
   <a href=\"/\">Return</a> to settings page</br>";
  }
  str += "</body></html>";
  server.send ( 200, "text/html", str );
}

void web0() { 
   String str0 = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
          str0 += "<center><b><big>После перезагрузки ESP8266 (светодиод на плате начнет мигать) перейдите по <a href='./'>ссылке</a>";
          server.send (200, "text/html", str0);sumbit();
} 

14

Re: ESP8266+WS2811 = часы

Доработка - после авторизации в wi-fi сети, точка доступа сообщает новый IP адрес, не надо открывать монитор порта.
http://forum.rcl-radio.ru/uploads/images/2020/12/7ccab753f9fbfdfa1deacaa504c69413.png

#include <NTPClient.h>
#include <ESP8266WiFi.h> 
#include <WiFiUdp.h> 
#include <Wire.h> 
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>
#ifndef APSSID
#define APSSID "ESPap"
#define APPSK  "12345678"
#endif
const char *ssid = APSSID;
const char *password = APPSK;
 ESP8266WebServer server(80);
 WiFiUDP ntpUDP;
 Adafruit_NeoPixel strip = Adafruit_NeoPixel(45, D6, NEO_GRB + NEO_KHZ400);//  трек, D6  
 NTPClient timeClient(ntpUDP, "pool.ntp.org", 0,3600123);
 String date_time,date;
 unsigned long times,times1;
 int ss,mm,hh,dd,mon,yer;
 int hear10,hear0,min10,min0,sec10,sec0;
 int hhh,ss_old;
 int brignes,utc;
 int r,g,b,cv,cv1;
 byte len_ssid, len_pass;

 
 
void setup(){
  delay(1000);timeClient.begin();
  EEPROM.begin(512);
  len_ssid = EEPROM.read(96);
  len_pass = EEPROM.read(97);
 if(len_pass > 64) len_pass = 0;

  brignes = EEPROM.read(200);
  utc = EEPROM.read(201);
  cv = EEPROM.read(202);
  cv1 = EEPROM.read(203);
  if(brignes<10||brignes>255){brignes=10;}
  timeClient.setTimeOffset(utc*1800);
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(5,INPUT_PULLUP);// D1

 /// точка доступа
  if(digitalRead(5)==LOW){
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/ok", handleOk);
  server.begin();
  Serial.println("HTTP server started");  
  }
  else{
        // Режим STATION
      WiFi.mode( WIFI_STA);
      unsigned char* buf_ssid = new unsigned char[32];
      unsigned char* buf_pass = new unsigned char[64];
      for(byte i = 0; i < len_ssid; i++) buf_ssid[i] = char(EEPROM.read(i));
      buf_ssid[len_ssid] = '\x0';
      const char *ssid  = (const char*)buf_ssid;
      for(byte i = 0; i < len_pass; i++) buf_pass[i] = char(EEPROM.read(i + 32));
      const char *pass  = (const char*)buf_pass;
      buf_pass[len_pass] = '\x0';
      delay(2000);
      Serial.print("SSID: ");
      Serial.print(ssid);
      Serial.print("   ");
      Serial.print("Password: ");
      Serial.println(pass);
       
     WiFi.begin(ssid, pass);
      // Wait for connection
      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());
      server.on("/", web);
      server.on("/reset", web0);
      server.begin();
      Serial.println(brignes);
      Serial.println(utc);
      Serial.println(cv);
      Serial.println(cv1);
    }
  strip.begin();
}
 
void loop(){
  server.handleClient();

  if(digitalRead(5)==HIGH){
  //// Time //////////////////////////////////////////
  if(millis()-times>=1000){times=millis();
   while(!timeClient.update()){timeClient.forceUpdate();}
   hh = timeClient.getHours();
   mm = timeClient.getMinutes();
   ss = timeClient.getSeconds();
  date_time = timeClient.getFormattedDate();
  int index_date = date_time.indexOf("T");
  date = date_time.substring(0, index_date);
  char charBufVar[11];date.toCharArray(charBufVar, 11);
   dd = int(charBufVar[0]-'0')*10+int(charBufVar[1]-'0');
   mon = int(charBufVar[3]-'0')*10+int(charBufVar[4]-'0');
   yer = int(charBufVar[8]-'0')*10+int(charBufVar[9]-'0');
  }
  Serial.print(hh/10);Serial.print(hh%10);Serial.print(":");Serial.print(mm/10);Serial.print(mm%10);Serial.print(":");Serial.print(ss/10);Serial.println(ss%10);
  //// ws2812 /////////////////////////////////////////

 if(ss>10&&ss<15){hear10=dd/10;hear0=dd%10;min10=mon/10;min0=mon%10;sec10=yer/10;sec0=yer%10;hhh=1;}
  else{hear10=hh/10;hear0=hh%10;min10=mm/10;min0=mm%10;sec10=ss/10;sec0=ss%10;hhh=0;}
 
  
  switch(hear10){   
    case 0: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);break;
    case 1: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 2: ws(0,1);ws(1,2);ws(2,0);ws(3,1);ws(4,1);ws(5,0);ws(6,1);break;
    case 3: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,0);ws(6,1);break;
    case 4: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;
    case 5: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
    case 6: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 7: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 8: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 9: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
   case 10: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;// " "
   case 11: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "t"
   case 12: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "P"
   case 13: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "H"
   case 14: ws(0,1);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "C"
   case 15: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;// градус
    }
   switch(hear0){   
    case 0: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,0);break;
    case 1: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 2: ws(7,1);ws(8,2);ws(9,0);ws(10,1);ws(11,1);ws(12,0);ws(13,1);break;
    case 3: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,0);ws(13,1);break;
    case 4: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;
    case 5: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
    case 6: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 7: ws(7,1);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 8: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 9: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
   case 10: ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;// " "
   case 11: ws(7,0);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "t"
   case 12: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "P"
   case 13: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "H"
   case 14: ws(7,1);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "C"
   case 15: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;// градус   
    } 

/// двоеточние и запятая
   if(hhh==0){
   if(ss!=ss_old){times1=millis();}  
   if(millis()-times1<500){ws1(14,1);ws1(15,1);ws1(30,1); digitalWrite(2, HIGH);}
   else{ws1(14,0);ws1(15,0);ws1(30,0); digitalWrite(2, LOW);}
   ss_old=ss;}

   if(hhh==1){ws1(14,1);ws1(15,0);ws1(30,1); digitalWrite(2, LOW);}
    
   switch(min10){   
    case 0: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,0);break;
    case 1: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;    
    case 2: ws(16,1);ws(17,2);ws(18,0);ws(19,1);ws(20,1);ws(21,0);ws(22,1);break;
    case 3: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,0);ws(22,1);break;
    case 4: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;
    case 5: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
    case 6: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 7: ws(16,1);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;
    case 8: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 9: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
   case 10: ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;// " " 
   case 11: ws(16,0);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "t" 
   case 12: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "P"
   case 13: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "H"
   case 14: ws(16,1);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "C"
   case 15: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;// градус  
    }
   switch(min0){   
    case 0: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,0);break;
    case 1: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 2: ws(23,1);ws(24,2);ws(25,0);ws(26,1);ws(27,1);ws(28,0);ws(29,1);break;
    case 3: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,1);break;
    case 4: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;
    case 5: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
    case 6: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 7: ws(23,1);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 8: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 9: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
   case 10: ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;// " " 
   case 11: ws(23,0);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "t" 
   case 12: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "P"
   case 13: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "H"
   case 14: ws(23,1);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "C"
   case 15: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;// градус  
    } 

    

   switch(sec10){   
    case 0: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,0);break;
    case 1: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 2: ws(31,1);ws(32,2);ws(33,0);ws(34,1);ws(35,1);ws(36,0);ws(37,1);break;
    case 3: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,0);ws(37,1);break;
    case 4: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;
    case 5: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
    case 6: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 7: ws(31,1);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 8: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 9: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
   case 10: ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;// " " 
   case 11: ws(31,0);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "t" 
   case 12: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "P"
   case 13: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "H"
   case 14: ws(31,1);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "C"
   case 15: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;// градус    
    }
   switch(sec0){   
    case 0: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,0);break;
    case 1: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 2: ws(38,1);ws(39,2);ws(40,0);ws(41,1);ws(42,1);ws(43,0);ws(44,1);break;
    case 3: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,0);ws(44,1);break;
    case 4: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;
    case 5: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
    case 6: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 7: ws(38,1);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 8: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 9: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
   case 10: ws(38,0);ws(39,0);ws(40,0);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;// " " 
   case 11: ws(38,0);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "t" 
   case 12: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "P"
   case 13: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "H"
   case 14: ws(38,1);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "C"
   case 15: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;// градус    
    } 
  strip.show();
  }
  delay(100);
  }

void ws(int ind, bool datt){
  if(cv==1){r=brignes;g=0;b=0;}
  if(cv==2){r=0;g=brignes;b=0;}
  if(cv==3){r=0;g=0;b=brignes;}
  if(cv==0){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(r, g, b));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }
void ws1(int ind, bool datt){
  if(cv1==1){r=brignes;g=0;b=0;}
  if(cv1==2){r=0;g=brignes;b=0;}
  if(cv1==3){r=0;g=0;b=brignes;}
  if(cv1==0){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(r, g, b));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }  

void web(){ 
   String webPage = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
   //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>";
    /////////////   
          webPage += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='10'>";
          webPage +="<td><h1><center>ESP8266<br>Страница настройки Интернет часов</h1>";
          webPage +="<tr><td><center><big>Текущее время: ";
          webPage += hh/10;webPage += hh%10; webPage +=":";webPage +=mm/10;
          webPage += mm%10; webPage +=":";webPage +=ss/10;webPage += ss%10;
          webPage += "</center>";
          webPage += "<form method='POST' action='reset' >";
          webPage += "<tr><td><input name='brignes'  autocomplete='off' maxlength='3' size='1'> Яркость 10...255 ";
          webPage += "<br>Установлено: ";webPage += brignes;
          webPage += "<tr><td><input name='time_utc'  autocomplete='off' maxlength='3' size='1'> Временной сдвиг UTC (30 мин)";
          webPage += "<br>Установлено: ";webPage += utc;
          webPage += " (";webPage += utc*0.5;webPage += " ч.)";
          
          webPage += "<tr><td><input name='cv'  autocomplete='off' maxlength='3' size='1'> Цвет цифр 0...3";
          webPage += "<br>0 - белый, 1 - красный, 2 - зеленый, 3 - синий";
          webPage += "<br>Установлено: ";webPage += cv;

          webPage += "<tr><td><input name='cv1'  autocomplete='off' maxlength='3' size='1'> Цвет двоеточия и запятой 0...3";
          webPage += "<br>0 - белый, 1 - красный, 2 - зеленый, 3 - синий";
          webPage += "<br>Установлено: ";webPage += cv1;
 
          webPage += "<tr><td><center><input type=SUBMIT value='Сохранить настройки'>";
          webPage += "</form>";
          webPage += "<center><br>Заполните все ячейки формы, незаполненная ячейка формы будет сохранена как 0";
   server.send(200, "text/html", webPage);//sumbit();
}

void sumbit(){ 
    if (server.args() > 0 ) {
    for ( uint8_t i = 0; i < server.args(); i++ ) {
      if (server.argName(i) == "brignes"){brignes = server.arg(i).toInt();}
      if (server.argName(i) == "time_utc"){utc = server.arg(i).toInt();}
      if (server.argName(i) == "cv"){cv = server.arg(i).toInt();}
      if (server.argName(i) == "cv1"){cv1 = server.arg(i).toInt();}
      }
      Serial.println("Save");
      Serial.println(brignes);
      Serial.println(utc);
      Serial.println(cv);
      Serial.println(cv1);
      EEPROM.begin(512);
      EEPROM.write(200,brignes);
      EEPROM.write(201,utc);
      EEPROM.write(202,cv);
      EEPROM.write(203,cv1);
      EEPROM.commit();
      delay(1000);ESP.restart();
      }}

void handleRoot() { 
   String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
   //style
          str += "<head><style>.tab1 {background-color:#F5F5F5;border-radius: 5px;margin: auto;}";
          str += "#menu1{list-style:none; width:100%; padding:0 0 0 0 ; margin: 0 0 0 0;background: #999;}";
          str += "#menu1 li{float:left; font:bold 14px Arial;text-shadow: 1px 1px 0px #000;}";
          str += "#menu1 a{color:#fff; display:block; height:36px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "#menu1 a:hover{color:#fff; background:#555;}";
          str += "#menu1 b{color:#fff; display:block; height:25px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "</style></head>";
   ////////////       
          str += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='10'>";
          str +="<td><h1><center>ESP8266<br>Авторизация</h1>";
          str += "<form method='POST' action='ok'>";
          str += "<tr><td><input name='ssid'  autocomplete='off'><big> Имя Wi-Fi сети";
          str += "<tr><td><input name='pswd'  autocomplete='off'><big> Пароль";
          str += "<tr><td><center><input type=SUBMIT value='Сохранить настройки'>";
          str += "</form>";
server.send ( 200, "text/html", str );
}      

void handleOk(){
  String ssid_ap;
  String pass_ap;
  unsigned char* buf = new unsigned char[64];
 
  String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";;
  str += "<body>";
 
  EEPROM.begin(512);
 
  ssid_ap = server.arg(0);
  pass_ap = server.arg(1);
 
  if(ssid_ap != ""){
    EEPROM.write(96,ssid_ap.length());
    EEPROM.write(97,pass_ap.length());
    ssid_ap.getBytes(buf, ssid_ap.length() + 1);
    for(byte i = 0; i < ssid_ap.length(); i++)
      EEPROM.write(i, buf[i]);
      
    pass_ap.getBytes(buf, pass_ap.length() + 1);
    for(byte i = 0; i < pass_ap.length(); i++)
      EEPROM.write(i + 32, buf[i]);
      
    EEPROM.commit();
    EEPROM.end();
/////////////////////////
    WiFi.begin(ssid_ap, pass_ap);
      // Wait for connection
      while (WiFi.status() != WL_CONNECTED){delay (500);}
 ///////////////////////////////////////////////////////////////////////////  
    str +="<big><center>Конфигурация сохранена в память<br>";
    str +="<big><center>Уберите перемычку с D1 и перезагрузите ESP8266</p><br>";
    str +="<big><b><center>";
    str += WiFi.localIP().toString();
    str +="</b><hr>";
    str +="<a href=\"/\">Return</a> to settings page</br>";
  }
  else {
    str += "<big><center>No WIFI Net</br>\
   <a href=\"/\">Return</a> to settings page</br>";
  }
  str += "</body></html>";
  server.send ( 200, "text/html", str );
}

void web0() { 
   String str0 = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
          str0 += "<center><b><big>После перезагрузки ESP8266 (светодиод на плате начнет мигать) перейдите по <a href='./'>ссылке</a>";
          server.send (200, "text/html", str0);sumbit();
} 

15

Re: ESP8266+WS2811 = часы

http://forum.rcl-radio.ru/uploads/images/2021/01/2218b4a5069b274071a619560d96466a.jpg http://forum.rcl-radio.ru/uploads/images/2021/01/fff6201af0d9dbdbf7faedddc757a4b1.jpg

16

Re: ESP8266+WS2811 = часы

Доработка часов

  • Добавлена регулировка яркости по времени в % от установленного значения.

  • Не обязательно заполнять все ячейки формы, если ячейка не была заполнена, то будет сохранено предыдущее значение настроек.

http://forum.rcl-radio.ru/uploads/images/2021/01/fc5af6d9056f1e969b4946cb6c13398a.png

#include <NTPClient.h>
#include <ESP8266WiFi.h> 
#include <WiFiUdp.h> 
#include <Wire.h> 
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>
#ifndef APSSID
#define APSSID "ESPap"
#define APPSK  "12345678"
#endif
const char *ssid = APSSID;
const char *password = APPSK;
 ESP8266WebServer server(80);
 WiFiUDP ntpUDP;
 Adafruit_NeoPixel strip = Adafruit_NeoPixel(45, D6, NEO_GRB + NEO_KHZ400);//  трек, D6  
 NTPClient timeClient(ntpUDP, "pool.ntp.org", 0,3600123);
 String date_time,date;
 unsigned long times,times1;
 int ss,mm,hh,dd,mon,yer;
 int hear10,hear0,min10,min0,sec10,sec0;
 int hhh,ss_old;
 int brignes,utc;
 int r,g,b,cv,cv1,h1,h2,h3,h4,m1,m2,m3,m4;
 float br,br1,br2,br3,br4;
 byte len_ssid, len_pass;

 
 
void setup(){
  delay(1000);timeClient.begin();
  EEPROM.begin(512);
  len_ssid = EEPROM.read(96);
  len_pass = EEPROM.read(97);
 if(len_pass > 64) len_pass = 0;

  brignes = EEPROM.read(200);
  utc = EEPROM.read(201);
  cv = EEPROM.read(202);
  cv1 = EEPROM.read(203);
  h1 = EEPROM.read(204);m1 = EEPROM.read(205);br1 = EEPROM.read(206);
  h2 = EEPROM.read(207);m2 = EEPROM.read(208);br2 = EEPROM.read(209);
  h3 = EEPROM.read(210);m3 = EEPROM.read(211);br3 = EEPROM.read(212);
  h4 = EEPROM.read(213);m4 = EEPROM.read(214);br4 = EEPROM.read(215);
  if(brignes<10||brignes>255){brignes=10;}
  timeClient.setTimeOffset(utc*1800);
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(5,INPUT_PULLUP);// D1

 /// точка доступа
  if(digitalRead(5)==LOW){
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/ok", handleOk);
  server.begin();
  Serial.println("HTTP server started");  
  }
  else{
        // Режим STATION
      WiFi.mode( WIFI_STA);
      unsigned char* buf_ssid = new unsigned char[32];
      unsigned char* buf_pass = new unsigned char[64];
      for(byte i = 0; i < len_ssid; i++) buf_ssid[i] = char(EEPROM.read(i));
      buf_ssid[len_ssid] = '\x0';
      const char *ssid  = (const char*)buf_ssid;
      for(byte i = 0; i < len_pass; i++) buf_pass[i] = char(EEPROM.read(i + 32));
      const char *pass  = (const char*)buf_pass;
      buf_pass[len_pass] = '\x0';
      delay(2000);
      Serial.print("SSID: ");
      Serial.print(ssid);
      Serial.print("   ");
      Serial.print("Password: ");
      Serial.println(pass);
       
     WiFi.begin(ssid, pass);
      // Wait for connection
      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());
      server.on("/", web);
      server.on("/reset", web0);
      server.begin();
      Serial.println(brignes);
      Serial.println(utc);
      Serial.println(cv);
      Serial.println(cv1);
    }
  strip.begin();
}
 
void loop(){
  server.handleClient();

  if(digitalRead(5)==HIGH){
  //// Time //////////////////////////////////////////
  if(millis()-times>=1000){times=millis();
   while(!timeClient.update()){timeClient.forceUpdate();}
   hh = timeClient.getHours();
   mm = timeClient.getMinutes();
   ss = timeClient.getSeconds();
  date_time = timeClient.getFormattedDate();
  int index_date = date_time.indexOf("T");
  date = date_time.substring(0, index_date);
  char charBufVar[11];date.toCharArray(charBufVar, 11);
   dd = int(charBufVar[0]-'0')*10+int(charBufVar[1]-'0');
   mon = int(charBufVar[3]-'0')*10+int(charBufVar[4]-'0');
   yer = int(charBufVar[8]-'0')*10+int(charBufVar[9]-'0');
  }
  Serial.print(hh/10);Serial.print(hh%10);Serial.print(":");Serial.print(mm/10);Serial.print(mm%10);Serial.print(":");Serial.print(ss/10);Serial.println(ss%10);
  Serial.println(br);
  Serial.println(int(r*br/100.00));
  //// ws2812 /////////////////////////////////////////

 if(ss>10&&ss<15){hear10=dd/10;hear0=dd%10;min10=mon/10;min0=mon%10;sec10=yer/10;sec0=yer%10;hhh=1;}
  else{hear10=hh/10;hear0=hh%10;min10=mm/10;min0=mm%10;sec10=ss/10;sec0=ss%10;hhh=0;}
 
  
  switch(hear10){   
    case 0: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);break;
    case 1: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 2: ws(0,1);ws(1,2);ws(2,0);ws(3,1);ws(4,1);ws(5,0);ws(6,1);break;
    case 3: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,0);ws(6,1);break;
    case 4: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;
    case 5: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
    case 6: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 7: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 8: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 9: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
   case 10: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;// " "
   case 11: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "t"
   case 12: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "P"
   case 13: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "H"
   case 14: ws(0,1);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "C"
   case 15: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;// градус
    }
   switch(hear0){   
    case 0: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,0);break;
    case 1: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 2: ws(7,1);ws(8,2);ws(9,0);ws(10,1);ws(11,1);ws(12,0);ws(13,1);break;
    case 3: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,0);ws(13,1);break;
    case 4: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;
    case 5: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
    case 6: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 7: ws(7,1);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 8: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 9: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
   case 10: ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;// " "
   case 11: ws(7,0);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "t"
   case 12: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "P"
   case 13: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "H"
   case 14: ws(7,1);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "C"
   case 15: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;// градус   
    } 

/// двоеточние и запятая
   if(hhh==0){
   if(ss!=ss_old){times1=millis();}  
   if(millis()-times1<500){ws1(14,1);ws1(15,1);ws1(30,1); digitalWrite(2, HIGH);}
   else{ws1(14,0);ws1(15,0);ws1(30,0); digitalWrite(2, LOW);}
   ss_old=ss;}

   if(hhh==1){ws1(14,1);ws1(15,0);ws1(30,1); digitalWrite(2, LOW);}
    
   switch(min10){   
    case 0: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,0);break;
    case 1: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;    
    case 2: ws(16,1);ws(17,2);ws(18,0);ws(19,1);ws(20,1);ws(21,0);ws(22,1);break;
    case 3: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,0);ws(22,1);break;
    case 4: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;
    case 5: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
    case 6: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 7: ws(16,1);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;
    case 8: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 9: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
   case 10: ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;// " " 
   case 11: ws(16,0);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "t" 
   case 12: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "P"
   case 13: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "H"
   case 14: ws(16,1);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "C"
   case 15: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;// градус  
    }
   switch(min0){   
    case 0: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,0);break;
    case 1: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 2: ws(23,1);ws(24,2);ws(25,0);ws(26,1);ws(27,1);ws(28,0);ws(29,1);break;
    case 3: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,1);break;
    case 4: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;
    case 5: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
    case 6: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 7: ws(23,1);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 8: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 9: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
   case 10: ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;// " " 
   case 11: ws(23,0);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "t" 
   case 12: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "P"
   case 13: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "H"
   case 14: ws(23,1);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "C"
   case 15: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;// градус  
    } 

    

   switch(sec10){   
    case 0: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,0);break;
    case 1: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 2: ws(31,1);ws(32,2);ws(33,0);ws(34,1);ws(35,1);ws(36,0);ws(37,1);break;
    case 3: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,0);ws(37,1);break;
    case 4: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;
    case 5: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
    case 6: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 7: ws(31,1);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 8: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 9: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
   case 10: ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;// " " 
   case 11: ws(31,0);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "t" 
   case 12: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "P"
   case 13: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "H"
   case 14: ws(31,1);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "C"
   case 15: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;// градус    
    }
   switch(sec0){   
    case 0: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,0);break;
    case 1: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 2: ws(38,1);ws(39,2);ws(40,0);ws(41,1);ws(42,1);ws(43,0);ws(44,1);break;
    case 3: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,0);ws(44,1);break;
    case 4: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;
    case 5: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
    case 6: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 7: ws(38,1);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 8: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 9: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
   case 10: ws(38,0);ws(39,0);ws(40,0);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;// " " 
   case 11: ws(38,0);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "t" 
   case 12: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "P"
   case 13: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "H"
   case 14: ws(38,1);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "C"
   case 15: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;// градус    
    } 
  strip.show();
  }
  delay(100);
  }

void ws(int ind, bool datt){
  if(cv==2){r=brignes;g=0;b=0;}
  if(cv==3){r=0;g=brignes;b=0;}
  if(cv==4){r=0;g=0;b=brignes;}

  if(hh*100+mm>=h1*100+m1&&hh*100+mm<h2*100+m2){br=br1;}
  if(hh*100+mm>=h2*100+m2&&hh*100+mm<h3*100+m3){br=br2;}
  if(hh*100+mm>=h3*100+m3&&hh*100+mm<h4*100+m4){br=br3;}
  if(hh*100+mm>=h4*100+m4 && hh*100+mm<2359){br=br4;}
  if(hh*100+mm<h1*100+m1 && hh*100+mm>0){br=br4;}
  
  if(cv==0||cv==1){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(int(r*br/100.00), int(g*br/100.00), int(b*br/100.00)));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }
void ws1(int ind, bool datt){
  if(cv1==2){r=brignes;g=0;b=0;}
  if(cv1==3){r=0;g=brignes;b=0;}
  if(cv1==4){r=0;g=0;b=brignes;}
  if(cv1==0||cv1==1){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(int(r*br/100.00), int(g*br/100.00), int(b*br/100.00)));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }  

void web(){ 
   String webPage = "<meta charset='utf-8'><meta name='viewport' content='width=700, user-scalable=no' />";
   //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>";
    /////////////   
          webPage += "<TABLE class='tab1' align='center' width='700' BORDER='1' cellspacing='0' cellpadding='3'>";
          webPage +="<td colspan='2'><h1><center>ESP8266<br>Страница настройки Интернет часов</h1>";
          webPage +="<tr><td colspan='2'><center><big>Текущее время: ";
          webPage += hh/10;webPage += hh%10; webPage +=":";webPage +=mm/10;
          webPage += mm%10; webPage +=":";webPage +=ss/10;webPage += ss%10;
          webPage += "</center>";
          webPage += "<form method='POST' action='reset' >";
          webPage += "<tr><td><input name='brignes'  autocomplete='off' maxlength='3' size='1'> Яркость 10...255 ";
          webPage += "<br><small>Установлено: ";webPage += brignes;
          webPage += "<td><input name='time_utc'  autocomplete='off' maxlength='3' size='1'> Временной сдвиг UTC (30 мин)";
          webPage += "<br><small>Установлено: ";webPage += utc;
          webPage += " (";webPage += utc*0.5;webPage += " ч.)";
          
          webPage += "<tr><td><input name='cv'  autocomplete='off' maxlength='3' size='1'> Цвет цифр 1...4";
          webPage += "<br>1 - белый, 2 - красный, 3 - синий, 4 - зеленый";
          webPage += "<br><small>Установлено: ";webPage += cv;

          webPage += "<td><input name='cv1'  autocomplete='off' maxlength='3' size='1'> Цвет двоеточия и запятой 1...4";
          webPage += "<br>1 - белый, 2 - красный, 3 - синий, 4 - зеленый";
          webPage += "<br><small>Установлено: ";webPage += cv1;
////////////////////////////////
          webPage += "<tr><td colspan='2'><center><b>Регулировка яркости по времени</b><br><br>";
          webPage += "<center><input name='h1' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m1'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br1'  autocomplete='off' maxlength='3' size='1'> % яркости";
          webPage += "<br><small>Установлено: ";webPage += h1/10;webPage += h1%10;webPage += ":";
          webPage += m1/10;webPage += m1%10;webPage += " >> ";webPage += int(br1);webPage += "%";webPage +="</small>";

          webPage += "<br>";
          webPage += "<center><input name='h2' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m2'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br2'  autocomplete='off' maxlength='3' size='1'> % яркости";
          webPage += "<br><small>Установлено: ";webPage += h2/10;webPage += h2%10;webPage += ":";
          webPage += m2/10;webPage += m2%10;webPage += " >> ";webPage += int(br2);webPage += "%";webPage +="</small>";

          webPage += "<br>";
          webPage += "<center><input name='h3' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m3'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br3'  autocomplete='off' maxlength='3' size='1'> % яркости"; 
          webPage += "<br><small>Установлено: ";webPage += h3/10;webPage += h3%10;webPage += ":";
          webPage += m3/10;webPage += m3%10;webPage += " >> ";webPage += int(br3);webPage += "%";webPage +="</small>"; 

          webPage += "<br>";
          webPage += "<center><input name='h4' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m4'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br4'  autocomplete='off' maxlength='3' size='1'> % яркости";   
          webPage += "<br><small>Установлено: ";webPage += h4/10;webPage += h4%10;webPage += ":";
          webPage += m4/10;webPage += m4%10;webPage += " >> ";webPage += int(br4);webPage += "%";webPage +="</small>";    

          webPage +="<br><br><small>При установке времени соблюдайте временную последовательность, первая уставка начало суток, четвертая конец суток. Если необходимо установить яркость 20 % с 22:00 до 6:00, то установите первую уставку на 6:00, яркость 20%, четвертую на 22:00, яркость 20 %.</small>";                       
          webPage +="<br><small>Не используйте 00:00 как начало суток, время не будет сохранено в память!!!<small>";
////////////////////////////////          
 
          webPage += "<tr><td colspan='2'><center><br><input type=SUBMIT value='Сохранить настройки'>";
          webPage += "</form>";
          webPage += "<center><br>Заполните все ячейки формы, незаполненная ячейка формы не изменит ранее установленный параметр";
   server.send(200, "text/html", webPage);//sumbit();
}

void sumbit(){ 
    if (server.args() > 0 ) {
    for ( uint8_t i = 0; i < server.args(); i++ ) {
      if (server.argName(i) == "brignes"){brignes = server.arg(i).toInt();}
      if (server.argName(i) == "time_utc"){utc = server.arg(i).toInt();}
      if (server.argName(i) == "cv"){cv = server.arg(i).toInt();}
      if (server.argName(i) == "cv1"){cv1 = server.arg(i).toInt();}
      if (server.argName(i) == "h1"){h1 = server.arg(i).toInt();}
      if (server.argName(i) == "m1"){m1 = server.arg(i).toInt();}
      if (server.argName(i) == "br1"){br1 = 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) == "br2"){br2 = 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) == "br3"){br3 = 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) == "br4"){br4 = server.arg(i).toInt();}
      }
      Serial.println("Save");
      Serial.println(brignes);Serial.println(utc);Serial.println(cv);Serial.println(cv1);
      EEPROM.begin(512);
      if(brignes==NULL){}else{EEPROM.write(200,brignes);}
      if(utc==NULL){}else{EEPROM.write(201,utc);}
      if(cv==NULL){}else{EEPROM.write(202,cv);}
      if(cv1==NULL){}else{EEPROM.write(203,cv1);}

      if(h1*100+m1==NULL){}else{EEPROM.write(204,h1);EEPROM.write(205,m1);}
      if(br1==NULL){}else{EEPROM.write(206,br1);}
      if(h2*100+m2==NULL){}else{EEPROM.write(207,h2);EEPROM.write(208,m2);}
      if(br2==NULL){}else{EEPROM.write(209,br2);}
      if(h3*100+m3==NULL){}else{EEPROM.write(210,h3);EEPROM.write(211,m3);}
      if(br3==NULL){}else{EEPROM.write(212,br3);}
      if(h4*100+m4==NULL){}else{EEPROM.write(213,h4);EEPROM.write(214,m4);}
      if(br4==NULL){}else{EEPROM.write(215,br4);}
      EEPROM.commit();
      delay(1000);ESP.restart();
      }}

void handleRoot() { 
   String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
   //style
          str += "<head><style>.tab1 {background-color:#F5F5F5;border-radius: 5px;margin: auto;}";
          str += "#menu1{list-style:none; width:100%; padding:0 0 0 0 ; margin: 0 0 0 0;background: #999;}";
          str += "#menu1 li{float:left; font:bold 14px Arial;text-shadow: 1px 1px 0px #000;}";
          str += "#menu1 a{color:#fff; display:block; height:36px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "#menu1 a:hover{color:#fff; background:#555;}";
          str += "#menu1 b{color:#fff; display:block; height:25px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "</style></head>";
   ////////////       
          str += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='10'>";
          str +="<td><h1><center>ESP8266<br>Авторизация</h1>";
          str += "<form method='POST' action='ok'>";
          str += "<tr><td><input name='ssid'  autocomplete='off'><big> Имя Wi-Fi сети";
          str += "<tr><td><input name='pswd'  autocomplete='off'><big> Пароль";
          str += "<tr><td><center><input type=SUBMIT value='Сохранить настройки'>";
          str += "</form>";
server.send ( 200, "text/html", str );
}      

void handleOk(){
  String ssid_ap;
  String pass_ap;
  unsigned char* buf = new unsigned char[64];
 
  String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";;
  str += "<body>";
 
  EEPROM.begin(512);
 
  ssid_ap = server.arg(0);
  pass_ap = server.arg(1);
 
  if(ssid_ap != ""){
    EEPROM.write(96,ssid_ap.length());
    EEPROM.write(97,pass_ap.length());
    ssid_ap.getBytes(buf, ssid_ap.length() + 1);
    for(byte i = 0; i < ssid_ap.length(); i++)
      EEPROM.write(i, buf[i]);
      
    pass_ap.getBytes(buf, pass_ap.length() + 1);
    for(byte i = 0; i < pass_ap.length(); i++)
      EEPROM.write(i + 32, buf[i]);
      
    EEPROM.commit();
    EEPROM.end();
/////////////////////////
    WiFi.begin(ssid_ap, pass_ap);
      // Wait for connection
      while (WiFi.status() != WL_CONNECTED){delay (500);}
 ///////////////////////////////////////////////////////////////////////////  
    str +="<big><center>Конфигурация сохранена в память<br>";
    str +="<big><center>Уберите перемычку с D1 и перезагрузите ESP8266</p><br>";
    str +="<big><b><center>";
    str += WiFi.localIP().toString();
    str +="</b><hr>";
    str +="<a href=\"/\">Return</a> to settings page</br>";
  }
  else {
    str += "<big><center>No WIFI Net</br>\
   <a href=\"/\">Return</a> to settings page</br>";
  }
  str += "</body></html>";
  server.send ( 200, "text/html", str );
}

void web0() { 
   String str0 = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
          str0 += "<center><b><big>После перезагрузки ESP8266 (светодиод на плате начнет мигать) перейдите по <a href='./'>ссылке</a>";
          server.send (200, "text/html", str0);sumbit();
} 

17

Re: ESP8266+WS2811 = часы

Добавлен датчик BME280

Подключение BME280 к ESP8266:
3V — VIN
G — GND
D1 — SCL
D2 — SDA

http://forum.rcl-radio.ru/uploads/images/2021/02/39f0f505d71a2999e7b2697b1e756079.png

#include <NTPClient.h>
#include <ESP8266WiFi.h> 
#include <WiFiUdp.h> 
#include <Wire.h> 
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>
#include <Adafruit_Sensor.h>  // https://github.com/adafruit/Adafruit_Sensor
#include <Adafruit_BME280.h>  // https://github.com/adafruit/Adafruit_BME280_Library
#ifndef APSSID
#define APSSID "ESPap"
#define APPSK  "12345678"
#endif
const char *ssid = APSSID;
const char *password = APPSK;
 ESP8266WebServer server(80);
 WiFiUDP ntpUDP;
 Adafruit_NeoPixel strip = Adafruit_NeoPixel(45, D6, NEO_GRB + NEO_KHZ400);//  трек, D6  
 NTPClient timeClient(ntpUDP, "pool.ntp.org", 0,3600123);
 Adafruit_BME280 bme;
 String date_time,date;
 unsigned long times,times1;
 int ss,mm,hh,dd,mon,yer;
 int hear10,hear0,min10,min0,sec10,sec0;
 int hhh,ss_old;
 int brignes,utc;
 int r,g,b,cv,cv1,h1,h2,h3,h4,m1,m2,m3,m4;
 float br,br1,br2,br3,br4;
 byte len_ssid, len_pass;
 int d_start,d_end,p_start,p_end,h_start,h_end,t_start,t_end;
 int p_280,h_280,t_280;

 
 
void setup(){
  Serial.begin(9600);
  Wire.begin();
  delay(1000);timeClient.begin();
  if (!bme.begin(0x76)) {Serial.println("Could not find a valid BME280!"); while (1);}
  EEPROM.begin(512);
  len_ssid = EEPROM.read(96);
  len_pass = EEPROM.read(97);
 if(len_pass > 64) len_pass = 0;

  brignes = EEPROM.read(200);
  utc = EEPROM.read(201);
  cv = EEPROM.read(202);
  cv1 = EEPROM.read(203);
  h1 = EEPROM.read(204);m1 = EEPROM.read(205);br1 = EEPROM.read(206);
  h2 = EEPROM.read(207);m2 = EEPROM.read(208);br2 = EEPROM.read(209);
  h3 = EEPROM.read(210);m3 = EEPROM.read(211);br3 = EEPROM.read(212);
  h4 = EEPROM.read(213);m4 = EEPROM.read(214);br4 = EEPROM.read(215);
  d_start = EEPROM.read(216);d_end = EEPROM.read(217);
  p_start = EEPROM.read(218);p_end = EEPROM.read(219);
  h_start = EEPROM.read(220);h_end = EEPROM.read(221);
  t_start = EEPROM.read(222);t_end = EEPROM.read(223);

  if(brignes<10||brignes>255){brignes=10;}
  timeClient.setTimeOffset(utc*1800);
  
  //pinMode(2, OUTPUT);
  pinMode(5,INPUT_PULLUP);// D1

 /// точка доступа
  if(digitalRead(5)==LOW){
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/ok", handleOk);
  server.begin();
  Serial.println("HTTP server started");  
  }
  else{
        // Режим STATION
      WiFi.mode( WIFI_STA);
      unsigned char* buf_ssid = new unsigned char[32];
      unsigned char* buf_pass = new unsigned char[64];
      for(byte i = 0; i < len_ssid; i++) buf_ssid[i] = char(EEPROM.read(i));
      buf_ssid[len_ssid] = '\x0';
      const char *ssid  = (const char*)buf_ssid;
      for(byte i = 0; i < len_pass; i++) buf_pass[i] = char(EEPROM.read(i + 32));
      const char *pass  = (const char*)buf_pass;
      buf_pass[len_pass] = '\x0';
      delay(2000);
      Serial.print("SSID: ");
      Serial.print(ssid);
      Serial.print("   ");
      Serial.print("Password: ");
      Serial.println(pass);
       
     WiFi.begin(ssid, pass);
      // Wait for connection
      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());
      server.on("/", web);
      server.on("/reset", web0);
      server.begin();
      Serial.println(brignes);
      Serial.println(utc);
      Serial.println(cv);
      Serial.println(cv1);
    }
  strip.begin();
}
 
void loop(){
  server.handleClient();

  if(digitalRead(5)==HIGH){
  //// Time //////////////////////////////////////////
  if(millis()-times>=1000){times=millis();
   while(!timeClient.update()){timeClient.forceUpdate();}
   hh = timeClient.getHours();
   mm = timeClient.getMinutes();
   ss = timeClient.getSeconds();
  date_time = timeClient.getFormattedDate();
  int index_date = date_time.indexOf("T");
  date = date_time.substring(0, index_date);
  char charBufVar[11];date.toCharArray(charBufVar, 11);
   dd = int(charBufVar[0]-'0')*10+int(charBufVar[1]-'0');
   mon = int(charBufVar[3]-'0')*10+int(charBufVar[4]-'0');
   yer = int(charBufVar[8]-'0')*10+int(charBufVar[9]-'0');

   t_280 = int(bme.readTemperature()*10); 
   p_280 = int(bme.readPressure() / 100.0F * 7.5);                                      
   h_280 = int(bme.readHumidity()*10); 
   
  }
  Serial.print(hh/10);Serial.print(hh%10);Serial.print(":");Serial.print(mm/10);Serial.print(mm%10);Serial.print(":");Serial.print(ss/10);Serial.println(ss%10);
  Serial.println(br);
  Serial.println(int(r*br/100.00));

  
  //// ws2812 /////////////////////////////////////////

 if(ss>d_start&&ss<d_end){hear10=dd/10;hear0=dd%10;min10=mon/10;min0=mon%10;sec10=yer/10;sec0=yer%10;hhh=1;}
 else if(ss>p_start&&ss<p_end){hear10=12;hear0=p_280/1000%10;min10=p_280/100%10;min0=p_280/10%10;sec10=p_280%10;sec0=10;hhh=2;}
 else if(ss>h_start&&ss<h_end){hear10=13;hear0=10;min10=h_280/100%10;min0=h_280/10%10;sec10=h_280%10;sec0=10;hhh=2;}
 else if(ss>t_start&&ss<t_end){hear10=11;hear0=10;min10=t_280/100%10;min0=t_280/10%10;sec10=t_280%10;sec0=14;hhh=2;}
 else{hear10=hh/10;hear0=hh%10;min10=mm/10;min0=mm%10;sec10=ss/10;sec0=ss%10;hhh=0;}
 
  
  switch(hear10){   
    case 0: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);break;
    case 1: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 2: ws(0,1);ws(1,2);ws(2,0);ws(3,1);ws(4,1);ws(5,0);ws(6,1);break;
    case 3: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,0);ws(6,1);break;
    case 4: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;
    case 5: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
    case 6: ws(0,1);ws(1,0);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 7: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;
    case 8: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;
    case 9: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,0);ws(5,1);ws(6,1);break;
   case 10: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);break;// " "
   case 11: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);break;// "t"
   case 12: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "P"
   case 13: ws(0,0);ws(1,1);ws(2,1);ws(3,0);ws(4,1);ws(5,1);ws(6,1);break;// "H"
   case 14: ws(0,1);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,0);break;// "C"
   case 15: ws(0,1);ws(1,1);ws(2,0);ws(3,0);ws(4,0);ws(5,1);ws(6,1);break;// градус
    }
   switch(hear0){   
    case 0: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,0);break;
    case 1: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 2: ws(7,1);ws(8,2);ws(9,0);ws(10,1);ws(11,1);ws(12,0);ws(13,1);break;
    case 3: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,0);ws(13,1);break;
    case 4: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;
    case 5: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
    case 6: ws(7,1);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 7: ws(7,1);ws(8,1);ws(9,1);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;
    case 8: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;
    case 9: ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,0);ws(12,1);ws(13,1);break;
   case 10: ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);break;// " "
   case 11: ws(7,0);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,1);break;// "t"
   case 12: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "P"
   case 13: ws(7,0);ws(8,1);ws(9,1);ws(10,0);ws(11,1);ws(12,1);ws(13,1);break;// "H"
   case 14: ws(7,1);ws(8,0);ws(9,0);ws(10,1);ws(11,1);ws(12,1);ws(13,0);break;// "C"
   case 15: ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,1);ws(13,1);break;// градус   
    } 

/// двоеточние и запятая
   if(hhh==0){
   if(ss!=ss_old){times1=millis();}  
   if(millis()-times1<500){ws1(14,1);ws1(15,1);ws1(30,1); }
   else{ws1(14,0);ws1(15,0);ws1(30,0);}
   ss_old=ss;}


   if(hhh==1){ws1(14,1);ws1(15,0);ws1(30,1);}
   if(hhh==2){ws1(14,0);ws1(15,0);ws1(30,1);}
    
   switch(min10){   
    case 0: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,0);break;
    case 1: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;    
    case 2: ws(16,1);ws(17,2);ws(18,0);ws(19,1);ws(20,1);ws(21,0);ws(22,1);break;
    case 3: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,0);ws(22,1);break;
    case 4: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;
    case 5: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
    case 6: ws(16,1);ws(17,0);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 7: ws(16,1);ws(17,1);ws(18,1);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;
    case 8: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;
    case 9: ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,0);ws(21,1);ws(22,1);break;
   case 10: ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);ws(21,0);ws(22,0);break;// " " 
   case 11: ws(16,0);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,1);break;// "t" 
   case 12: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "P"
   case 13: ws(16,0);ws(17,1);ws(18,1);ws(19,0);ws(20,1);ws(21,1);ws(22,1);break;// "H"
   case 14: ws(16,1);ws(17,0);ws(18,0);ws(19,1);ws(20,1);ws(21,1);ws(22,0);break;// "C"
   case 15: ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);ws(21,1);ws(22,1);break;// градус  
    }
   switch(min0){   
    case 0: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,0);break;
    case 1: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 2: ws(23,1);ws(24,2);ws(25,0);ws(26,1);ws(27,1);ws(28,0);ws(29,1);break;
    case 3: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,1);break;
    case 4: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;
    case 5: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
    case 6: ws(23,1);ws(24,0);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 7: ws(23,1);ws(24,1);ws(25,1);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;
    case 8: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;
    case 9: ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,1);ws(29,1);break;
   case 10: ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);break;// " " 
   case 11: ws(23,0);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,1);break;// "t" 
   case 12: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "P"
   case 13: ws(23,0);ws(24,1);ws(25,1);ws(26,0);ws(27,1);ws(28,1);ws(29,1);break;// "H"
   case 14: ws(23,1);ws(24,0);ws(25,0);ws(26,1);ws(27,1);ws(28,1);ws(29,0);break;// "C"
   case 15: ws(23,1);ws(24,1);ws(25,0);ws(26,0);ws(27,0);ws(28,1);ws(29,1);break;// градус  
    } 

    

   switch(sec10){   
    case 0: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,0);break;
    case 1: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 2: ws(31,1);ws(32,2);ws(33,0);ws(34,1);ws(35,1);ws(36,0);ws(37,1);break;
    case 3: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,0);ws(37,1);break;
    case 4: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;
    case 5: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
    case 6: ws(31,1);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 7: ws(31,1);ws(32,1);ws(33,1);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;
    case 8: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;
    case 9: ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,0);ws(36,1);ws(37,1);break;
   case 10: ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);break;// " " 
   case 11: ws(31,0);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,1);break;// "t" 
   case 12: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "P"
   case 13: ws(31,0);ws(32,1);ws(33,1);ws(34,0);ws(35,1);ws(36,1);ws(37,1);break;// "H"
   case 14: ws(31,1);ws(32,0);ws(33,0);ws(34,1);ws(35,1);ws(36,1);ws(37,0);break;// "C"
   case 15: ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);break;// градус    
    }
   switch(sec0){   
    case 0: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,0);break;
    case 1: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 2: ws(38,1);ws(39,2);ws(40,0);ws(41,1);ws(42,1);ws(43,0);ws(44,1);break;
    case 3: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,0);ws(44,1);break;
    case 4: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;
    case 5: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
    case 6: ws(38,1);ws(39,0);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 7: ws(38,1);ws(39,1);ws(40,1);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;
    case 8: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;
    case 9: ws(38,1);ws(39,1);ws(40,1);ws(41,1);ws(42,0);ws(43,1);ws(44,1);break;
   case 10: ws(38,0);ws(39,0);ws(40,0);ws(41,0);ws(42,0);ws(43,0);ws(44,0);break;// " " 
   case 11: ws(38,0);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,1);break;// "t" 
   case 12: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "P"
   case 13: ws(38,0);ws(39,1);ws(40,1);ws(41,0);ws(42,1);ws(43,1);ws(44,1);break;// "H"
   case 14: ws(38,1);ws(39,0);ws(40,0);ws(41,1);ws(42,1);ws(43,1);ws(44,0);break;// "C"
   case 15: ws(38,1);ws(39,1);ws(40,0);ws(41,0);ws(42,0);ws(43,1);ws(44,1);break;// градус    
    } 
  strip.show();
  }
  delay(100);
  }

void ws(int ind, bool datt){
  if(cv==2){r=brignes;g=0;b=0;}
  if(cv==3){r=0;g=brignes;b=0;}
  if(cv==4){r=0;g=0;b=brignes;}

  if(hh*100+mm>=h1*100+m1&&hh*100+mm<h2*100+m2){br=br1;}
  if(hh*100+mm>=h2*100+m2&&hh*100+mm<h3*100+m3){br=br2;}
  if(hh*100+mm>=h3*100+m3&&hh*100+mm<h4*100+m4){br=br3;}
  if(hh*100+mm>=h4*100+m4 && hh*100+mm<2359){br=br4;}
  if(hh*100+mm<h1*100+m1 && hh*100+mm>0){br=br4;}
  
  if(cv==0||cv==1){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(int(r*br/100.00), int(g*br/100.00), int(b*br/100.00)));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }
void ws1(int ind, bool datt){
  if(cv1==2){r=brignes;g=0;b=0;}
  if(cv1==3){r=0;g=brignes;b=0;}
  if(cv1==4){r=0;g=0;b=brignes;}
  if(cv1==0||cv1==1){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(int(r*br/100.00), int(g*br/100.00), int(b*br/100.00)));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }  

void web(){ 
   String webPage = "<meta charset='utf-8'><meta name='viewport' content='width=700, user-scalable=no' />";
   //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>";
    /////////////   
          webPage += "<TABLE class='tab1' align='center' width='700' BORDER='1' cellspacing='0' cellpadding='3'>";
          webPage +="<td colspan='2'><h1><center>ESP8266<br>Страница настройки Интернет часов</h1>";
          webPage +="<tr><td colspan='2'><center><big>Текущее время: ";
          webPage += hh/10;webPage += hh%10; webPage +=":";webPage +=mm/10;
          webPage += mm%10; webPage +=":";webPage +=ss/10;webPage += ss%10;
          webPage += "</center>";
          webPage += "<form method='POST' action='reset' >";
          webPage += "<tr><td><input name='brignes'  autocomplete='off' maxlength='3' size='1'> Яркость 10...255 ";
          webPage += "<br><small>Установлено: ";webPage += brignes;
          webPage += "<td><input name='time_utc'  autocomplete='off' maxlength='3' size='1'> Временной сдвиг UTC (30 мин)";
          webPage += "<br><small>Установлено: ";webPage += utc;
          webPage += " (";webPage += utc*0.5;webPage += " ч.)";
          
          webPage += "<tr><td><input name='cv'  autocomplete='off' maxlength='3' size='1'> Цвет цифр 1...4";
          webPage += "<br>1 - белый, 2 - красный, 3 - синий, 4 - зеленый";
          webPage += "<br><small>Установлено: ";webPage += cv;

          webPage += "<td><input name='cv1'  autocomplete='off' maxlength='3' size='1'> Цвет двоеточия и запятой 1...4";
          webPage += "<br>1 - белый, 2 - красный, 3 - синий, 4 - зеленый";
          webPage += "<br><small>Установлено: ";webPage += cv1;
////////////////////////////////
          webPage += "<tr><td colspan='2'><center><b>Показания датчиков и даты (повтор каждую минуту)</b><tr><td>";
          webPage += "Дата с <input name='d_start' autocomplete='off' maxlength='3' size='1'> по <input name='d_end' autocomplete='off' maxlength='3' size='1'> секунду";
          webPage += "<br><small>Установлено: c ";webPage += d_start;webPage +=" по ";webPage += d_end;webPage += " сек";
          if(d_start<d_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
          webPage += "<br>Давление с <input name='p_start' autocomplete='off' maxlength='3' size='1'> по <input name='p_end' autocomplete='off' maxlength='3' size='1'> секунду";
          webPage += "<br><small>Установлено: c ";webPage += p_start;webPage +=" по ";webPage += p_end;webPage += " сек";
          if(p_start<p_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
          webPage += "<td>";
          webPage += "Влажность с <input name='h_start' autocomplete='off' maxlength='3' size='1'> по <input name='h_end' autocomplete='off' maxlength='3' size='1'> секунду";          
          webPage += "<br><small>Установлено: c ";webPage += h_start;webPage +=" по ";webPage += h_end;webPage += " сек";
          if(h_start<h_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
          webPage += "<br>Температура с <input name='t_start' autocomplete='off' maxlength='3' size='1'> по <input name='t_end' autocomplete='off' maxlength='3' size='1'> секунду";         
          webPage += "<br><small>Установлено: c ";webPage += t_start;webPage +=" по ";webPage += t_end;webPage += " сек";
          if(t_start<t_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
////////////////////////////////
          webPage += "<tr><td colspan='2'><center><b>Регулировка яркости по времени</b><br><br>";
          webPage += "<center><input name='h1' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m1'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br1'  autocomplete='off' maxlength='3' size='1'> % яркости";
          webPage += "<br><small>Установлено: ";webPage += h1/10;webPage += h1%10;webPage += ":";
          webPage += m1/10;webPage += m1%10;webPage += " >> ";webPage += int(br1);webPage += "%";webPage +="</small>";

          webPage += "<br>";
          webPage += "<center><input name='h2' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m2'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br2'  autocomplete='off' maxlength='3' size='1'> % яркости";
          webPage += "<br><small>Установлено: ";webPage += h2/10;webPage += h2%10;webPage += ":";
          webPage += m2/10;webPage += m2%10;webPage += " >> ";webPage += int(br2);webPage += "%";webPage +="</small>";

          webPage += "<br>";
          webPage += "<center><input name='h3' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m3'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br3'  autocomplete='off' maxlength='3' size='1'> % яркости"; 
          webPage += "<br><small>Установлено: ";webPage += h3/10;webPage += h3%10;webPage += ":";
          webPage += m3/10;webPage += m3%10;webPage += " >> ";webPage += int(br3);webPage += "%";webPage +="</small>"; 

          webPage += "<br>";
          webPage += "<center><input name='h4' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m4'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br4'  autocomplete='off' maxlength='3' size='1'> % яркости";   
          webPage += "<br><small>Установлено: ";webPage += h4/10;webPage += h4%10;webPage += ":";
          webPage += m4/10;webPage += m4%10;webPage += " >> ";webPage += int(br4);webPage += "%";webPage +="</small>";    

          webPage +="<br><br><small>При установке времени соблюдайте временную последовательность, первая уставка начало суток, четвертая конец суток. Если необходимо установить яркость 20 % с 22:00 до 6:00, то установите первую уставку на 6:00, яркость 20%, четвертую на 22:00, яркость 20 %.</small>";                       
          webPage +="<br><small>Не используйте 00:00 как начало суток, время не будет сохранено в память!!!<small>";
////////////////////////////////          
 
          webPage += "<tr><td colspan='2'><center><br><input type=SUBMIT value='Сохранить настройки'>";
          webPage += "</form>";
          webPage += "<center><br>Заполните все ячейки формы, незаполненная ячейка формы не изменит ранее установленный параметр";
   server.send(200, "text/html", webPage);//sumbit();
}

void sumbit(){ 
    if (server.args() > 0 ) {
    for ( uint8_t i = 0; i < server.args(); i++ ) {
      if (server.argName(i) == "brignes"){brignes = server.arg(i).toInt();}
      if (server.argName(i) == "time_utc"){utc = server.arg(i).toInt();}
      if (server.argName(i) == "cv"){cv = server.arg(i).toInt();}
      if (server.argName(i) == "cv1"){cv1 = server.arg(i).toInt();}
      if (server.argName(i) == "h1"){h1 = server.arg(i).toInt();}
      if (server.argName(i) == "m1"){m1 = server.arg(i).toInt();}
      if (server.argName(i) == "br1"){br1 = 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) == "br2"){br2 = 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) == "br3"){br3 = 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) == "br4"){br4 = server.arg(i).toInt();}

      if (server.argName(i) == "d_start"){d_start = server.arg(i).toInt();}
      if (server.argName(i) == "d_end"){d_end = server.arg(i).toInt();}
      if (server.argName(i) == "h_start"){h_start = server.arg(i).toInt();}
      if (server.argName(i) == "h_end"){h_end = server.arg(i).toInt();}
      if (server.argName(i) == "p_start"){p_start = server.arg(i).toInt();}
      if (server.argName(i) == "p_end"){p_end = server.arg(i).toInt();}
      if (server.argName(i) == "t_start"){t_start = server.arg(i).toInt();}
      if (server.argName(i) == "t_end"){t_end = server.arg(i).toInt();}
      }
      Serial.println("Save");
      Serial.println(brignes);Serial.println(utc);Serial.println(cv);Serial.println(cv1);
      EEPROM.begin(512);
      if(brignes==NULL){}else{EEPROM.write(200,brignes);}
      if(utc==NULL){}else{EEPROM.write(201,utc);}
      if(cv==NULL){}else{EEPROM.write(202,cv);}
      if(cv1==NULL){}else{EEPROM.write(203,cv1);}

      if(h1*100+m1==NULL){}else{EEPROM.write(204,h1);EEPROM.write(205,m1);}
      if(br1==NULL){}else{EEPROM.write(206,br1);}
      if(h2*100+m2==NULL){}else{EEPROM.write(207,h2);EEPROM.write(208,m2);}
      if(br2==NULL){}else{EEPROM.write(209,br2);}
      if(h3*100+m3==NULL){}else{EEPROM.write(210,h3);EEPROM.write(211,m3);}
      if(br3==NULL){}else{EEPROM.write(212,br3);}
      if(h4*100+m4==NULL){}else{EEPROM.write(213,h4);EEPROM.write(214,m4);}
      if(br4==NULL){}else{EEPROM.write(215,br4);}

      if(d_start==NULL){}else{EEPROM.write(216,d_start);}
      if(d_end==NULL){}else{EEPROM.write(217,d_end);}
      if(p_start==NULL){}else{EEPROM.write(218,p_start);}
      if(p_end==NULL){}else{EEPROM.write(219,p_end);}
      
      if(h_start==NULL){}else{EEPROM.write(220,h_start);}
      if(h_end==NULL){}else{EEPROM.write(221,h_end);}
      if(t_start==NULL){}else{EEPROM.write(222,t_start);}
      if(t_end==NULL){}else{EEPROM.write(223,t_end);}
      EEPROM.commit();
      delay(1000);ESP.restart();
      }}

void handleRoot() { 
   String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
   //style
          str += "<head><style>.tab1 {background-color:#F5F5F5;border-radius: 5px;margin: auto;}";
          str += "#menu1{list-style:none; width:100%; padding:0 0 0 0 ; margin: 0 0 0 0;background: #999;}";
          str += "#menu1 li{float:left; font:bold 14px Arial;text-shadow: 1px 1px 0px #000;}";
          str += "#menu1 a{color:#fff; display:block; height:36px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "#menu1 a:hover{color:#fff; background:#555;}";
          str += "#menu1 b{color:#fff; display:block; height:25px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "</style></head>";
   ////////////       
          str += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='10'>";
          str +="<td><h1><center>ESP8266<br>Авторизация</h1>";
          str += "<form method='POST' action='ok'>";
          str += "<tr><td><input name='ssid'  autocomplete='off'><big> Имя Wi-Fi сети";
          str += "<tr><td><input name='pswd'  autocomplete='off'><big> Пароль";
          str += "<tr><td><center><input type=SUBMIT value='Сохранить настройки'>";
          str += "</form>";
server.send ( 200, "text/html", str );
}      

void handleOk(){
  String ssid_ap;
  String pass_ap;
  unsigned char* buf = new unsigned char[64];
 
  String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";;
  str += "<body>";
 
  EEPROM.begin(512);
 
  ssid_ap = server.arg(0);
  pass_ap = server.arg(1);
 
  if(ssid_ap != ""){
    EEPROM.write(96,ssid_ap.length());
    EEPROM.write(97,pass_ap.length());
    ssid_ap.getBytes(buf, ssid_ap.length() + 1);
    for(byte i = 0; i < ssid_ap.length(); i++)
      EEPROM.write(i, buf[i]);
      
    pass_ap.getBytes(buf, pass_ap.length() + 1);
    for(byte i = 0; i < pass_ap.length(); i++)
      EEPROM.write(i + 32, buf[i]);
      
    EEPROM.commit();
    EEPROM.end();
/////////////////////////
    WiFi.begin(ssid_ap, pass_ap);
      // Wait for connection
      while (WiFi.status() != WL_CONNECTED){delay (500);}
 ///////////////////////////////////////////////////////////////////////////  
    str +="<big><center>Конфигурация сохранена в память<br>";
    str +="<big><center>Уберите перемычку с D1 и перезагрузите ESP8266</p><br>";
    str +="<big><b><center>";
    str += WiFi.localIP().toString();
    str +="</b><hr>";
    str +="<a href=\"/\">Return</a> to settings page</br>";
  }
  else {
    str += "<big><center>No WIFI Net</br>\
   <a href=\"/\">Return</a> to settings page</br>";
  }
  str += "</body></html>";
  server.send ( 200, "text/html", str );
}

void web0() { 
   String str0 = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
          str0 += "<center><b><big>После перезагрузки ESP8266 перейдите по <a href='./'>ссылке</a>";
          server.send (200, "text/html", str0);sumbit();
} 

18 (2023-02-09 16:10:15 отредактировано wwwinternetwww)

Re: ESP8266+WS2811 = часы

Здравствуйте . прошу помочь в скетче .
переписал на ws2812  128 led / 134 led  /
проблема в последней разработке  с BME280 .
записывает скетч , не могу зайти в режим точки wifi
если закрыть  строчки

//Adafruit_BME280 bme;

// if (!bme.begin(0x76))Serial.println("Could not find a valid BME280 sensor, check wiring!"); while (1); 

//  t_280 = int(bme.readTemperature()*10);
//   p_280 = int(bme.readPressure() / 100.0F * 7.5);                                     
  // h_280 = int(bme.readHumidity()*10);

после записи работает точка wifi  и меню такое же .
ВОПРОС МОЖЕТ БЫТЬ ЧТО НЕТ BME280 ИЗ ЗА ЭТОГО НЕ РАБОТАЕТ ЧАСЫ И РЕЖИМ ТОЧКА WIFI ???

МОЖЕТ БЫТЬ ПРОБЛЕМА В БИБЛИОТЕКЕ  ?

Adafruit_BME280_Library-master

Adafruit_BusIO-master

Adafruit_NeoPixel-master

Adafruit_Sensor-master

NTPClient-master

WiFi-1.2.7

19

Re: ESP8266+WS2811 = часы

датчик BME280

Подключение BME280 к ESP8266:
3V — VIN
G — GND
D1 — SCL
D2 — SDA

LED  WS2812

ОТРИЦАТЕЛЬНУЮ  ТЕМПЕРАТУРУ  - ДОРАБОТАЛИ - СПАСИБО  liman324



#include <ESP8266WiFi.h> 
#include <WiFiUdp.h> 
#include <Wire.h> 
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>
#include <Adafruit_Sensor.h>  // [url]https://github.com/adafruit/Adafruit_Sensor[/url]
#include <Adafruit_BME280.h>  // [url]https://github.com/adafruit/Adafruit_BME280_Library[/url]
#ifndef APSSID
#define APSSID "ESPap"         // прописываем свою точку wifi - заливаем скетч 
#define APPSK  "12345678"   //  ждем подключения к wifi - заходим в роутер и смотрим IP и заходим по IP
#endif
const char *ssid = APSSID;
const char *password = APPSK;
 ESP8266WebServer server(80);
 WiFiUDP ntpUDP;
 
 Adafruit_NeoPixel strip = Adafruit_NeoPixel(128, D6, NEO_GRB + NEO_KHZ800);//  трек, D6  
 NTPClient timeClient(ntpUDP, "pool.ntp.org", 0,3600123);
 
 Adafruit_BME280 bme;
 String date_time,date;
 unsigned long times,times1;
 int ss,mm,hh,dd,mon,yer;
 int hear10,hear0,min10,min0,sec10,sec0;
 int hhh,ss_old;
 int brignes,utc;
 int r,g,b,cv,cv1,h1,h2,h3,h4,m1,m2,m3,m4;
 float br,br1,br2,br3,br4;
 byte len_ssid, len_pass;
 int d_start,d_end,p_start,p_end,h_start,h_end,t_start,t_end;
 int p_280,h_280,t_280;

 
 
void setup(){
  Serial.begin(9600);
  Wire.begin();
  delay(1000);timeClient.begin();
  if (!bme.begin(0x76)) {Serial.println("Could not find a valid BME280!"); while (1);}
  EEPROM.begin(512);
  len_ssid = EEPROM.read(96);
  len_pass = EEPROM.read(97);
 if(len_pass > 64) len_pass = 0;

  brignes = EEPROM.read(200);
  utc = EEPROM.read(201);
  cv = EEPROM.read(202);
  cv1 = EEPROM.read(203);
  h1 = EEPROM.read(204);m1 = EEPROM.read(205);br1 = EEPROM.read(206);
  h2 = EEPROM.read(207);m2 = EEPROM.read(208);br2 = EEPROM.read(209);
  h3 = EEPROM.read(210);m3 = EEPROM.read(211);br3 = EEPROM.read(212);
  h4 = EEPROM.read(213);m4 = EEPROM.read(214);br4 = EEPROM.read(215);
  d_start = EEPROM.read(216);d_end = EEPROM.read(217);
  p_start = EEPROM.read(218);p_end = EEPROM.read(219);
  h_start = EEPROM.read(220);h_end = EEPROM.read(221);
  t_start = EEPROM.read(222);t_end = EEPROM.read(223);

  if(brignes<10||brignes>255){brignes=10;}
  timeClient.setTimeOffset(utc*1800);
  
  //pinMode(2, OUTPUT);
  pinMode(5,INPUT_PULLUP);// D1

 /// точка доступа
  if(digitalRead(5)==LOW){
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.on("/", handleRoot);
  server.on("/ok", handleOk);
  server.begin();
  Serial.println("HTTP server started");  
  }
  else{
        // Режим STATION
      WiFi.mode( WIFI_STA);
      unsigned char* buf_ssid = new unsigned char[32];
      unsigned char* buf_pass = new unsigned char[64];
      for(byte i = 0; i < len_ssid; i++) buf_ssid[i] = char(EEPROM.read(i));
      buf_ssid[len_ssid] = '\x0';
      const char *ssid  = (const char*)buf_ssid;
      for(byte i = 0; i < len_pass; i++) buf_pass[i] = char(EEPROM.read(i + 32));
      const char *pass  = (const char*)buf_pass;
      buf_pass[len_pass] = '\x0';
      delay(2000);
      Serial.print("SSID: ");
      Serial.print(ssid);
      Serial.print("   ");
      Serial.print("Password: ");
      Serial.println(pass);
       
     WiFi.begin(ssid, pass);
      // Wait for connection
      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());
      server.on("/", web);
      server.on("/reset", web0);
      server.begin();
      Serial.println(brignes);
      Serial.println(utc);
      Serial.println(cv);
      Serial.println(cv1);
    }
  strip.begin();
}

bool minus;
void loop(){
  server.handleClient();

  if(digitalRead(5)==HIGH){
  //// Time //////////////////////////////////////////
  if(millis()-times>=1000){times=millis();
   while(!timeClient.update()){timeClient.forceUpdate();}
   hh = timeClient.getHours();
   mm = timeClient.getMinutes();
   ss = timeClient.getSeconds();
  date_time = timeClient.getFormattedDate();
  int index_date = date_time.indexOf("T");
  date = date_time.substring(0, index_date);
  char charBufVar[11];date.toCharArray(charBufVar, 11);
   dd = int(charBufVar[0]-'0')*10+int(charBufVar[1]-'0');
   mon = int(charBufVar[3]-'0')*10+int(charBufVar[4]-'0');
   yer = int(charBufVar[8]-'0')*10+int(charBufVar[9]-'0');

   t_280 = int(bme.readTemperature()*10); 
   p_280 = int(bme.readPressure() / 100.0F * 7.5);                                      
   h_280 = int(bme.readHumidity()*10); 
  
if(t_280<0){t_280 = abs(t_280);minus=1;}else{minus=0;}
  }
  Serial.print(hh/10);Serial.print(hh%10);Serial.print(":");Serial.print(mm/10);Serial.print(mm%10);Serial.print(":");Serial.print(ss/10);Serial.println(ss%10);
  Serial.println(br);
  Serial.println(int(r*br/100.00));

  
  //// ws2812 /////////////////////////////////////////

 if(ss>d_start&&ss<d_end){hear10=dd/10;hear0=dd%10;min10=mon/10;min0=mon%10;sec10=yer/10;sec0=yer%10;hhh=1;}
 else if(ss>p_start&&ss<p_end){hear10=12;hear0=p_280/1000%10;min10=p_280/100%10;min0=p_280/10%10;sec10=p_280%10;sec0=10;hhh=2;}
 else if(ss>h_start&&ss<h_end){hear10=13;hear0=17;min10=h_280/100%10;min0=h_280/10%10;sec10=h_280%10;sec0=10;hhh=2;}

  else if(ss>t_start&&ss<t_end){hear10=14;if(minus==1){hear0=16;}else{hear0=10;}min10=t_280/100%10;min0=t_280/10%10;sec10=t_280%10;sec0=14;hhh=2;}
  else{hear10=hh/10;hear0=hh%10;min10=mm/10;min0=mm%10;sec10=ss/10;sec0=ss%10;hhh=0;}



  
 switch(hear10){   
    case 0: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);ws(14,1);ws(15,1);ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);break;
    case 1: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);ws(14,0);ws(15,0);ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);break;
    case 2: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);ws(7,0);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);ws(14,1);ws(15,0);ws(16,0);ws(17,0);ws(18,1);ws(19,1);ws(20,1);break;
    case 3: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,0);ws(13,0);ws(14,0);ws(15,0);ws(16,0);ws(17,0);ws(18,1);ws(19,1);ws(20,1);break;
    case 4: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);ws(14,0);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;
    case 5: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,1);ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,0);ws(13,0);ws(14,0);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;
    case 6: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,1);ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);ws(14,1);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;
    case 7: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);ws(14,0);ws(15,0);ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);break;
    case 8: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);ws(14,1);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;
    case 9: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,0);ws(13,0);ws(14,0);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;
   case 10: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);ws(14,0);ws(15,0);ws(16,0);ws(17,0);ws(18,0);ws(19,0);ws(20,0);break;// " "
   case 11: ws(0,0);ws(1,0);ws(2,0);ws(3,0);ws(4,0);ws(5,0);ws(6,0);ws(7,0);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);ws(14,1);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;// "t"
   case 12: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,1);ws(13,1);ws(14,1);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;// "P"
   case 13: ws(0,0);ws(1,0);ws(2,0);ws(3,1);ws(4,1);ws(5,1);ws(6,1);ws(7,1);ws(8,1);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);ws(14,1);ws(15,0);ws(16,0);ws(17,0);ws(18,1);ws(19,1);ws(20,1);break;// "H"
   case 14: ws(0,1);ws(1,1);ws(2,1);ws(3,0);ws(4,0);ws(5,0);ws(6,0);ws(7,0);ws(8,0);ws(9,1);ws(10,1);ws(11,1);ws(12,1);ws(13,1);ws(14,1);ws(15,1);ws(16,1);ws(17,1);ws(18,0);ws(19,0);ws(20,0);break;// "C"
   case 15: ws(0,1);ws(1,1);ws(2,1);ws(3,1);ws(4,1);ws(5,1);ws(6,0);ws(7,0);ws(8,0);ws(9,0);ws(10,0);ws(11,0);ws(12,0);ws(13,0);ws(14,0);ws(15,1);ws(16,1);ws(17,1);ws(18,1);ws(19,1);ws(20,1);break;// градус
 }

    
   switch(hear0){   
    case 0: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,1);ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,0);ws(40,0);ws(41,0);break;
    case 1: ws(21,0);ws(22,0);ws(23,0);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,0);ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);ws(38,0);ws(39,0);ws(40,0);ws(41,0);break;
    case 2: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,0);ws(30,1);ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,0);ws(37,0);ws(38,0);ws(39,1);ws(40,1);ws(41,1);break;
    case 3: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,1);ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);ws(38,0);ws(39,1);ws(40,1);ws(41,1);break;
    case 4: ws(21,0);ws(22,0);ws(23,0);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,0);ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;
    case 5: ws(21,1);ws(22,1);ws(23,1);ws(24,0);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);ws(30,1);ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;
    case 6: ws(21,1);ws(22,1);ws(23,1);ws(24,0);ws(25,0);ws(26,0);ws(27,1);ws(28,1);ws(29,1);ws(30,1);ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;
    case 7: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,0);ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);ws(38,0);ws(39,0);ws(40,0);ws(41,0);break;
    case 8: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,1);ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;
    case 9: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,1);ws(31,1);ws(32,1);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;
   case 10: ws(21,0);ws(22,0);ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);ws(30,0);ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);ws(38,0);ws(39,0);ws(40,0);ws(41,0);break;// " "
   case 11: ws(21,0);ws(22,0);ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);ws(30,1);ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;// "t"
   case 12: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,0);ws(30,0);ws(31,0);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;// "P"
   case 13: ws(21,0);ws(22,0);ws(23,0);ws(24,1);ws(25,1);ws(26,1);ws(27,1);ws(28,1);ws(29,1);ws(30,0);ws(31,0);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;// "H"
   case 14: ws(21,1);ws(22,1);ws(23,1);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);ws(30,1);ws(31,1);ws(32,1);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;// "C"
   case 15: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,0);ws(30,0);ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;// градус
   case 16: ws(21,0);ws(22,0);ws(23,0);ws(24,0);ws(25,0);ws(26,0);ws(27,0);ws(28,0);ws(29,0);ws(30,0);ws(31,0);ws(32,0);ws(33,0);ws(34,0);ws(35,0);ws(36,0);ws(37,0);ws(38,0);ws(39,1);ws(40,1);ws(41,1);break;//  минус
   case 17: ws(21,1);ws(22,1);ws(23,1);ws(24,1);ws(25,1);ws(26,1);ws(27,0);ws(28,0);ws(29,0);ws(30,0);ws(31,0);ws(32,0);ws(33,1);ws(34,1);ws(35,1);ws(36,1);ws(37,1);ws(38,1);ws(39,1);ws(40,1);ws(41,1);break;// "%"
    
    }
 
/// двоеточие и запятая
   if(hhh==0){
   if(ss!=ss_old){times1=millis();}  
   if(millis()-times1<500){ws1(42,1);ws1(43,1);ws1(86,1); digitalWrite(2, HIGH);}
                      else{ws1(42,0);ws1(43,0);ws1(86,0); digitalWrite(2, LOW);}
   ss_old=ss;}
 
   if(hhh==1){ws1(42,1);ws1(86,1); digitalWrite(2, LOW);}

    switch(min10){   
    case 0: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,1);ws(54,1);ws(55,1);ws(56,1);ws(57,1);ws(58,1);ws(59,1);ws(60,1);ws(61,1);ws(62,0);ws(63,0);ws(64,0);break;
    case 1: ws(44,0);ws(45,0);ws(46,0);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,0);ws(54,0);ws(55,0);ws(56,0);ws(57,0);ws(58,0);ws(59,0);ws(60,0);ws(61,0);ws(62,0);ws(63,0);ws(64,0);break;
    case 2: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,0);ws(51,0);ws(52,0);ws(53,1);ws(54,1);ws(55,1);ws(56,1);ws(57,1);ws(58,1);ws(59,0);ws(60,0);ws(61,0);ws(62,1);ws(63,1);ws(64,1);break;
    case 3: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,1);ws(54,1);ws(55,1);ws(56,0);ws(57,0);ws(58,0);ws(59,0);ws(60,0);ws(61,0);ws(62,1);ws(63,1);ws(64,1);break;
    case 4: ws(44,0);ws(45,0);ws(46,0);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,0);ws(54,0);ws(55,0);ws(56,0);ws(57,0);ws(58,0);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;
    case 5: ws(44,1);ws(45,1);ws(46,1);ws(47,0);ws(48,0);ws(49,0);ws(50,1);ws(51,1);ws(52,1);ws(53,1);ws(54,1);ws(55,1);ws(56,0);ws(57,0);ws(58,0);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;
    case 6: ws(44,1);ws(45,1);ws(46,1);ws(47,0);ws(48,0);ws(49,0);ws(50,1);ws(51,1);ws(52,1);ws(53,1);ws(54,1);ws(55,1);ws(56,1);ws(57,1);ws(58,1);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;
    case 7: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,0);ws(54,0);ws(55,0);ws(56,0);ws(57,0);ws(58,0);ws(59,0);ws(60,0);ws(61,0);ws(62,0);ws(63,0);ws(64,0);break;
    case 8: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,1);ws(54,1);ws(55,1);ws(56,1);ws(57,1);ws(58,1);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;
    case 9: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,1);ws(54,1);ws(55,1);ws(56,0);ws(57,0);ws(58,0);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;
   case 10: ws(44,0);ws(45,0);ws(46,0);ws(47,0);ws(48,0);ws(49,0);ws(50,0);ws(51,0);ws(52,0);ws(53,0);ws(54,0);ws(55,0);ws(56,0);ws(57,0);ws(58,0);ws(59,0);ws(60,0);ws(61,0);ws(62,0);ws(63,0);ws(64,0);break;// " "
   case 11: ws(44,0);ws(45,0);ws(46,0);ws(47,0);ws(48,0);ws(49,0);ws(50,0);ws(51,0);ws(52,0);ws(53,1);ws(54,1);ws(55,1);ws(56,1);ws(57,1);ws(58,1);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;// "t"
   case 12: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,0);ws(51,0);ws(52,0);ws(53,0);ws(54,0);ws(55,0);ws(56,1);ws(57,1);ws(58,1);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;// "P"
   case 13: ws(44,0);ws(45,0);ws(46,0);ws(47,1);ws(48,1);ws(49,1);ws(50,1);ws(51,1);ws(52,1);ws(53,0);ws(54,0);ws(55,0);ws(56,1);ws(57,1);ws(58,1);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;// "H"
   case 14: ws(44,1);ws(45,1);ws(46,1);ws(47,0);ws(48,0);ws(49,0);ws(50,0);ws(51,0);ws(52,0);ws(53,1);ws(54,1);ws(55,1);ws(56,1);ws(57,1);ws(58,1);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;// "C"
   case 15: ws(44,1);ws(45,1);ws(46,1);ws(47,1);ws(48,1);ws(49,1);ws(50,0);ws(51,0);ws(52,0);ws(53,0);ws(54,0);ws(55,0);ws(56,0);ws(57,0);ws(58,0);ws(59,1);ws(60,1);ws(61,1);ws(62,1);ws(63,1);ws(64,1);break;// градус
    }

    
   switch(min0){   
    case 0: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,1);ws(75,1);ws(76,1);ws(77,1);ws(78,1);ws(79,1);ws(80,1);ws(81,1);ws(82,1);ws(83,0);ws(84,0);ws(85,0);break;
    case 1: ws(65,0);ws(66,0);ws(67,0);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,0);ws(75,0);ws(76,0);ws(77,0);ws(78,0);ws(79,0);ws(80,0);ws(81,0);ws(82,0);ws(83,0);ws(84,0);ws(85,0);break;
    case 2: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,0);ws(72,0);ws(73,0);ws(74,1);ws(75,1);ws(76,1);ws(77,1);ws(78,1);ws(79,1);ws(80,0);ws(81,0);ws(82,0);ws(83,1);ws(84,1);ws(85,1);break;
    case 3: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,1);ws(75,1);ws(76,1);ws(77,0);ws(78,0);ws(79,0);ws(80,0);ws(81,0);ws(82,0);ws(83,1);ws(84,1);ws(85,1);break;
    case 4: ws(65,0);ws(66,0);ws(67,0);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,0);ws(75,0);ws(76,0);ws(77,0);ws(78,0);ws(79,0);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;
    case 5: ws(65,1);ws(66,1);ws(67,1);ws(68,0);ws(69,0);ws(70,0);ws(71,1);ws(72,1);ws(73,1);ws(74,1);ws(75,1);ws(76,1);ws(77,0);ws(78,0);ws(79,0);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;
    case 6: ws(65,1);ws(66,1);ws(67,1);ws(68,0);ws(69,0);ws(70,0);ws(71,1);ws(72,1);ws(73,1);ws(74,1);ws(75,1);ws(76,1);ws(77,1);ws(78,1);ws(79,1);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;
    case 7: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,0);ws(75,0);ws(76,0);ws(77,0);ws(78,0);ws(79,0);ws(80,0);ws(81,0);ws(82,0);ws(83,0);ws(84,0);ws(85,0);break;
    case 8: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,1);ws(75,1);ws(76,1);ws(77,1);ws(78,1);ws(79,1);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;
    case 9: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,1);ws(75,1);ws(76,1);ws(77,0);ws(78,0);ws(79,0);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;
   case 10: ws(65,0);ws(66,0);ws(67,0);ws(68,0);ws(69,0);ws(70,0);ws(71,0);ws(72,0);ws(73,0);ws(74,0);ws(75,0);ws(76,0);ws(77,0);ws(78,0);ws(79,0);ws(80,0);ws(81,0);ws(82,0);ws(83,0);ws(84,0);ws(85,0);break;// " "
   case 11: ws(65,0);ws(66,0);ws(67,0);ws(68,0);ws(69,0);ws(70,0);ws(71,0);ws(72,0);ws(73,0);ws(74,1);ws(75,1);ws(76,1);ws(77,1);ws(78,1);ws(79,1);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;// "t"
   case 12: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,0);ws(72,0);ws(73,0);ws(74,0);ws(75,0);ws(76,0);ws(77,1);ws(78,1);ws(79,1);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;// "P"
   case 13: ws(65,0);ws(66,0);ws(67,0);ws(68,1);ws(69,1);ws(70,1);ws(71,1);ws(72,1);ws(73,1);ws(74,0);ws(75,0);ws(76,0);ws(77,1);ws(78,1);ws(79,1);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;// "H"
   case 14: ws(65,1);ws(66,1);ws(67,1);ws(68,0);ws(69,0);ws(70,0);ws(71,0);ws(72,0);ws(73,0);ws(74,1);ws(75,1);ws(76,1);ws(77,1);ws(78,1);ws(79,1);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;// "C"
   case 15: ws(65,1);ws(66,1);ws(67,1);ws(68,1);ws(69,1);ws(70,1);ws(71,0);ws(72,0);ws(73,0);ws(74,0);ws(75,0);ws(76,0);ws(77,0);ws(78,0);ws(79,0);ws(80,1);ws(81,1);ws(82,1);ws(83,1);ws(84,1);ws(85,1);break;// градус
    }

 
 
   switch(sec10){   
    case 0: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,1);ws(97,1);ws(98,1);ws(99,1);ws(100,1);ws(101,1);ws(102,1);ws(103,1);ws(104,1);ws(105,0);ws(106,0);ws(107,0);break;
    case 1: ws(87,0);ws(88,0);ws(89,0);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,0);ws(97,0);ws(98,0);ws(99,0);ws(100,0);ws(101,0);ws(102,0);ws(103,0);ws(104,0);ws(105,0);ws(106,0);ws(107,0);break;
    case 2: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,0);ws(94,0);ws(95,0);ws(96,1);ws(97,1);ws(98,1);ws(99,1);ws(100,1);ws(101,1);ws(102,0);ws(103,0);ws(104,0);ws(105,1);ws(106,1);ws(107,1);break;
    case 3: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,1);ws(97,1);ws(98,1);ws(99,0);ws(100,0);ws(101,0);ws(102,0);ws(103,0);ws(104,0);ws(105,1);ws(106,1);ws(107,1);break;
    case 4: ws(87,0);ws(88,0);ws(89,0);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,0);ws(97,0);ws(98,0);ws(99,0);ws(100,0);ws(101,0);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;
    case 5: ws(87,1);ws(88,1);ws(89,1);ws(90,0);ws(91,0);ws(92,0);ws(93,1);ws(94,1);ws(95,1);ws(96,1);ws(97,1);ws(98,1);ws(99,0);ws(100,0);ws(101,0);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;
    case 6: ws(87,1);ws(88,1);ws(89,1);ws(90,0);ws(91,0);ws(92,0);ws(93,1);ws(94,1);ws(95,1);ws(96,1);ws(97,1);ws(98,1);ws(99,1);ws(100,1);ws(101,1);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;
    case 7: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,0);ws(97,0);ws(98,0);ws(99,0);ws(100,0);ws(101,0);ws(102,0);ws(103,0);ws(104,0);ws(105,0);ws(106,0);ws(107,0);break;
    case 8: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,1);ws(97,1);ws(98,1);ws(99,1);ws(100,1);ws(101,1);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;
    case 9: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,1);ws(97,1);ws(98,1);ws(99,0);ws(100,0);ws(101,0);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;
   case 10: ws(87,0);ws(88,0);ws(89,0);ws(90,0);ws(91,0);ws(92,0);ws(93,0);ws(94,0);ws(95,0);ws(96,0);ws(97,0);ws(98,0);ws(99,0);ws(100,0);ws(101,0);ws(102,0);ws(103,0);ws(104,0);ws(105,0);ws(106,0);ws(107,0);break;// " "
   case 11: ws(87,0);ws(88,0);ws(89,0);ws(90,0);ws(91,0);ws(92,0);ws(93,0);ws(94,0);ws(95,0);ws(96,1);ws(97,1);ws(98,1);ws(99,1);ws(100,1);ws(101,1);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;// "t"
   case 12: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,0);ws(94,0);ws(95,0);ws(96,0);ws(97,0);ws(98,0);ws(99,1);ws(100,1);ws(101,1);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;// "P"
   case 13: ws(87,0);ws(88,0);ws(89,0);ws(90,1);ws(91,1);ws(92,1);ws(93,1);ws(94,1);ws(95,1);ws(96,0);ws(97,0);ws(98,0);ws(99,1);ws(100,1);ws(101,1);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;// "H"
   case 14: ws(87,1);ws(88,1);ws(89,1);ws(90,0);ws(91,0);ws(92,0);ws(93,0);ws(94,0);ws(95,0);ws(96,1);ws(97,1);ws(98,1);ws(99,1);ws(100,1);ws(101,1);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;// "C"
   case 15: ws(87,1);ws(88,1);ws(89,1);ws(90,1);ws(91,1);ws(92,1);ws(93,0);ws(94,0);ws(95,0);ws(96,0);ws(97,0);ws(98,0);ws(99,0);ws(100,0);ws(101,0);ws(102,1);ws(103,1);ws(104,1);ws(105,1);ws(106,1);ws(107,1);break;// градус
    }


   switch(sec0){   
    case 0: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,1);ws(118,1);ws(119,1);ws(120,1);ws(121,1);ws(122,1);ws(123,1);ws(124,1);ws(125,1);ws(126,0);ws(127,0);ws(128,0);break;
    case 1: ws(108,0);ws(109,0);ws(110,0);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,0);ws(118,0);ws(119,0);ws(120,0);ws(121,0);ws(122,0);ws(123,0);ws(124,0);ws(125,0);ws(126,0);ws(127,0);ws(128,0);break;
    case 2: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,0);ws(115,0);ws(116,0);ws(117,1);ws(118,1);ws(119,1);ws(120,1);ws(121,1);ws(122,1);ws(123,0);ws(124,0);ws(125,0);ws(126,1);ws(127,1);ws(128,1);break;
    case 3: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,1);ws(118,1);ws(119,1);ws(120,0);ws(121,0);ws(122,0);ws(123,0);ws(124,0);ws(125,0);ws(126,1);ws(127,1);ws(128,1);break;
    case 4: ws(108,0);ws(109,0);ws(110,0);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,0);ws(118,0);ws(119,0);ws(120,0);ws(121,0);ws(122,0);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;
    case 5: ws(108,1);ws(109,1);ws(110,1);ws(111,0);ws(112,0);ws(113,0);ws(114,1);ws(115,1);ws(116,1);ws(117,1);ws(118,1);ws(119,1);ws(120,0);ws(121,0);ws(122,0);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;
    case 6: ws(108,1);ws(109,1);ws(110,1);ws(111,0);ws(112,0);ws(113,0);ws(114,1);ws(115,1);ws(116,1);ws(117,1);ws(118,1);ws(119,1);ws(120,1);ws(121,1);ws(122,1);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;
    case 7: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,0);ws(118,0);ws(119,0);ws(120,0);ws(121,0);ws(122,0);ws(123,0);ws(124,0);ws(125,0);ws(126,0);ws(127,0);ws(128,0);break;
    case 8: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,1);ws(118,1);ws(119,1);ws(120,1);ws(121,1);ws(122,1);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;
    case 9: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,1);ws(118,1);ws(119,1);ws(120,0);ws(121,0);ws(122,0);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;
   case 10: ws(108,0);ws(109,0);ws(110,0);ws(111,0);ws(112,0);ws(113,0);ws(114,0);ws(115,0);ws(116,0);ws(117,0);ws(118,0);ws(119,0);ws(120,0);ws(121,0);ws(122,0);ws(123,0);ws(124,0);ws(125,0);ws(126,0);ws(127,0);ws(128,0);break;// " "
   case 11: ws(108,0);ws(109,0);ws(110,0);ws(111,0);ws(112,0);ws(113,0);ws(114,0);ws(115,0);ws(116,0);ws(117,1);ws(118,1);ws(119,1);ws(120,1);ws(121,1);ws(122,1);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;// "t"
   case 12: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,0);ws(115,0);ws(116,0);ws(117,0);ws(118,0);ws(119,0);ws(120,1);ws(121,1);ws(122,1);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;// "P"
   case 13: ws(108,0);ws(109,0);ws(110,0);ws(111,1);ws(112,1);ws(113,1);ws(114,1);ws(115,1);ws(116,1);ws(117,0);ws(118,0);ws(119,0);ws(120,1);ws(121,1);ws(122,1);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;// "H"
   case 14: ws(108,1);ws(109,1);ws(110,1);ws(111,0);ws(112,0);ws(113,0);ws(114,0);ws(115,0);ws(116,0);ws(117,1);ws(118,1);ws(119,1);ws(120,1);ws(121,1);ws(122,1);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;// "C"
   case 15: ws(108,1);ws(109,1);ws(110,1);ws(111,1);ws(112,1);ws(113,1);ws(114,0);ws(115,0);ws(116,0);ws(117,0);ws(118,0);ws(119,0);ws(120,0);ws(121,0);ws(122,0);ws(123,1);ws(124,1);ws(125,1);ws(126,1);ws(127,1);ws(128,1);break;// градус
    }
  strip.show();
  }
  delay(100);
  }

void ws(int ind, bool datt){
  if(cv==2){r=brignes;g=0;b=0;}
  if(cv==3){r=0;g=brignes;b=0;}
  if(cv==4){r=0;g=0;b=brignes;}

  if(hh*100+mm>=h1*100+m1&&hh*100+mm<h2*100+m2){br=br1;}
  if(hh*100+mm>=h2*100+m2&&hh*100+mm<h3*100+m3){br=br2;}
  if(hh*100+mm>=h3*100+m3&&hh*100+mm<h4*100+m4){br=br3;}
  if(hh*100+mm>=h4*100+m4 && hh*100+mm<2359){br=br4;}
  if(hh*100+mm<h1*100+m1 && hh*100+mm>0){br=br4;}
  
  if(cv==0||cv==1){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(int(r*br/100.00), int(g*br/100.00), int(b*br/100.00)));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }
void ws1(int ind, bool datt){
  if(cv1==2){r=brignes;g=0;b=0;}
  if(cv1==3){r=0;g=brignes;b=0;}
  if(cv1==4){r=0;g=0;b=brignes;}
  if(cv1==0||cv1==1){r=brignes;g=brignes;b=brignes;}
  if(datt==1){strip.setPixelColor(ind, strip.Color(int(r*br/100.00), int(g*br/100.00), int(b*br/100.00)));}
  if(datt==0){strip.setPixelColor(ind, strip.Color(0, 0, 0));}
  }  

void web(){ 
   String webPage = "<meta charset='utf-8'><meta name='viewport' content='width=700, user-scalable=no' />";
   //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>";
    /////////////   
          webPage += "<TABLE class='tab1' align='center' width='700' BORDER='1' cellspacing='0' cellpadding='3'>";
          webPage +="<td colspan='2'><h1><center>ESP8266<br>Страница настройки Интернет часов</h1>";
          webPage +="<tr><td colspan='2'><center><big>Текущее время: ";
          webPage += hh/10;webPage += hh%10; webPage +=":";webPage +=mm/10;
          webPage += mm%10; webPage +=":";webPage +=ss/10;webPage += ss%10;
          webPage += "</center>";
          webPage += "<form method='POST' action='reset' >";
          webPage += "<tr><td><input name='brignes'  autocomplete='off' maxlength='3' size='1'> Яркость 10...255 ";
          webPage += "<br><small>Установлено: ";webPage += brignes;
          webPage += "<td><input name='time_utc'  autocomplete='off' maxlength='3' size='1'> Временной сдвиг UTC (30 мин)";
          webPage += "<br><small>Установлено: ";webPage += utc;
          webPage += " (";webPage += utc*0.5;webPage += " ч.)";
          
          webPage += "<tr><td><input name='cv'  autocomplete='off' maxlength='3' size='1'> Цвет цифр 1...4";
          webPage += "<br>1 - белый, 2 - красный, 3 - синий, 4 - зеленый";
          webPage += "<br><small>Установлено: ";webPage += cv;

          webPage += "<td><input name='cv1'  autocomplete='off' maxlength='3' size='1'> Цвет двоеточия и запятой 1...4";
          webPage += "<br>1 - белый, 2 - красный, 3 - синий, 4 - зеленый";
          webPage += "<br><small>Установлено: ";webPage += cv1;
////////////////////////////////
          webPage += "<tr><td colspan='2'><center><b>Показания датчиков и даты (повтор каждую минуту)</b><tr><td>";
          webPage += "Дата с <input name='d_start' autocomplete='off' maxlength='3' size='1'> по <input name='d_end' autocomplete='off' maxlength='3' size='1'> секунду";
          webPage += "<br><small>Установлено: c ";webPage += d_start;webPage +=" по ";webPage += d_end;webPage += " сек";
          if(d_start<d_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
          webPage += "<br>Давление с <input name='p_start' autocomplete='off' maxlength='3' size='1'> по <input name='p_end' autocomplete='off' maxlength='3' size='1'> секунду";
          webPage += "<br><small>Установлено: c ";webPage += p_start;webPage +=" по ";webPage += p_end;webPage += " сек";
          if(p_start<p_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
          webPage += "<td>";
          webPage += "Влажность с <input name='h_start' autocomplete='off' maxlength='3' size='1'> по <input name='h_end' autocomplete='off' maxlength='3' size='1'> секунду";          
          webPage += "<br><small>Установлено: c ";webPage += h_start;webPage +=" по ";webPage += h_end;webPage += " сек";
          if(h_start<h_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
          webPage += "<br>Температура с <input name='t_start' autocomplete='off' maxlength='3' size='1'> по <input name='t_end' autocomplete='off' maxlength='3' size='1'> секунду";         
          webPage += "<br><small>Установлено: c ";webPage += t_start;webPage +=" по ";webPage += t_end;webPage += " сек";
          if(t_start<t_end){webPage += " | Активно </small>";}else{webPage += " | Не активно </small>";}
////////////////////////////////
          webPage += "<tr><td colspan='2'><center><b>Регулировка яркости по времени</b><br><br>";
          webPage += "<center><input name='h1' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m1'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br1'  autocomplete='off' maxlength='3' size='1'> % яркости";
          webPage += "<br><small>Установлено: ";webPage += h1/10;webPage += h1%10;webPage += ":";
          webPage += m1/10;webPage += m1%10;webPage += " >> ";webPage += int(br1);webPage += "%";webPage +="</small>";

          webPage += "<br>";
          webPage += "<center><input name='h2' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m2'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br2'  autocomplete='off' maxlength='3' size='1'> % яркости";
          webPage += "<br><small>Установлено: ";webPage += h2/10;webPage += h2%10;webPage += ":";
          webPage += m2/10;webPage += m2%10;webPage += " >> ";webPage += int(br2);webPage += "%";webPage +="</small>";

          webPage += "<br>";
          webPage += "<center><input name='h3' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m3'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br3'  autocomplete='off' maxlength='3' size='1'> % яркости"; 
          webPage += "<br><small>Установлено: ";webPage += h3/10;webPage += h3%10;webPage += ":";
          webPage += m3/10;webPage += m3%10;webPage += " >> ";webPage += int(br3);webPage += "%";webPage +="</small>"; 

          webPage += "<br>";
          webPage += "<center><input name='h4' autocomplete='off' maxlength='3' size='1'> : ";
          webPage += "<input name='m4'  autocomplete='off' maxlength='3' size='1'> HH:MM >> ";
          webPage += "<input name='br4'  autocomplete='off' maxlength='3' size='1'> % яркости";   
          webPage += "<br><small>Установлено: ";webPage += h4/10;webPage += h4%10;webPage += ":";
          webPage += m4/10;webPage += m4%10;webPage += " >> ";webPage += int(br4);webPage += "%";webPage +="</small>";    

          webPage +="<br><br><small>При установке времени соблюдайте временную последовательность, первая уставка начало суток, четвертая конец суток. Если необходимо установить яркость 20 % с 22:00 до 6:00, то установите первую уставку на 6:00, яркость 20%, четвертую на 22:00, яркость 20 %.</small>";                       
          webPage +="<br><small>Не используйте 00:00 как начало суток, время не будет сохранено в память!!!<small>";
////////////////////////////////          
 
          webPage += "<tr><td colspan='2'><center><br><input type=SUBMIT value='Сохранить настройки'>";
          webPage += "</form>";
          webPage += "<center><br>Заполните все ячейки формы, незаполненная ячейка формы не изменит ранее установленный параметр";
   server.send(200, "text/html", webPage);//sumbit();
}

void sumbit(){ 
    if (server.args() > 0 ) {
    for ( uint8_t i = 0; i < server.args(); i++ ) {
      if (server.argName(i) == "brignes"){brignes = server.arg(i).toInt();}
      if (server.argName(i) == "time_utc"){utc = server.arg(i).toInt();}
      if (server.argName(i) == "cv"){cv = server.arg(i).toInt();}
      if (server.argName(i) == "cv1"){cv1 = server.arg(i).toInt();}
      if (server.argName(i) == "h1"){h1 = server.arg(i).toInt();}
      if (server.argName(i) == "m1"){m1 = server.arg(i).toInt();}
      if (server.argName(i) == "br1"){br1 = 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) == "br2"){br2 = 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) == "br3"){br3 = 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) == "br4"){br4 = server.arg(i).toInt();}

      if (server.argName(i) == "d_start"){d_start = server.arg(i).toInt();}
      if (server.argName(i) == "d_end"){d_end = server.arg(i).toInt();}
      if (server.argName(i) == "h_start"){h_start = server.arg(i).toInt();}
      if (server.argName(i) == "h_end"){h_end = server.arg(i).toInt();}
      if (server.argName(i) == "p_start"){p_start = server.arg(i).toInt();}
      if (server.argName(i) == "p_end"){p_end = server.arg(i).toInt();}
      if (server.argName(i) == "t_start"){t_start = server.arg(i).toInt();}
      if (server.argName(i) == "t_end"){t_end = server.arg(i).toInt();}
      }
      Serial.println("Save");
      Serial.println(brignes);Serial.println(utc);Serial.println(cv);Serial.println(cv1);
      EEPROM.begin(512);
      if(brignes==NULL){}else{EEPROM.write(200,brignes);}
      if(utc==NULL){}else{EEPROM.write(201,utc);}
      if(cv==NULL){}else{EEPROM.write(202,cv);}
      if(cv1==NULL){}else{EEPROM.write(203,cv1);}

      if(h1*100+m1==NULL){}else{EEPROM.write(204,h1);EEPROM.write(205,m1);}
      if(br1==NULL){}else{EEPROM.write(206,br1);}
      if(h2*100+m2==NULL){}else{EEPROM.write(207,h2);EEPROM.write(208,m2);}
      if(br2==NULL){}else{EEPROM.write(209,br2);}
      if(h3*100+m3==NULL){}else{EEPROM.write(210,h3);EEPROM.write(211,m3);}
      if(br3==NULL){}else{EEPROM.write(212,br3);}
      if(h4*100+m4==NULL){}else{EEPROM.write(213,h4);EEPROM.write(214,m4);}
      if(br4==NULL){}else{EEPROM.write(215,br4);}

      if(d_start==NULL){}else{EEPROM.write(216,d_start);}
      if(d_end==NULL){}else{EEPROM.write(217,d_end);}
      if(p_start==NULL){}else{EEPROM.write(218,p_start);}
      if(p_end==NULL){}else{EEPROM.write(219,p_end);}
      
      if(h_start==NULL){}else{EEPROM.write(220,h_start);}
      if(h_end==NULL){}else{EEPROM.write(221,h_end);}
      if(t_start==NULL){}else{EEPROM.write(222,t_start);}
      if(t_end==NULL){}else{EEPROM.write(223,t_end);}
      EEPROM.commit();
      delay(1000);ESP.restart();
      }}

void handleRoot() { 
   String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
   //style
          str += "<head><style>.tab1 {background-color:#F5F5F5;border-radius: 5px;margin: auto;}";
          str += "#menu1{list-style:none; width:100%; padding:0 0 0 0 ; margin: 0 0 0 0;background: #999;}";
          str += "#menu1 li{float:left; font:bold 14px Arial;text-shadow: 1px 1px 0px #000;}";
          str += "#menu1 a{color:#fff; display:block; height:36px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "#menu1 a:hover{color:#fff; background:#555;}";
          str += "#menu1 b{color:#fff; display:block; height:25px; line-height:36px; padding:10px 10px 10px 10px; background:#4682B4; text-decoration:none;}";
          str += "</style></head>";
   ////////////       
          str += "<TABLE class='tab1' align='center' width='470' BORDER='1' cellspacing='0' cellpadding='10'>";
          str +="<td><h1><center>ESP8266<br>Авторизация</h1>";
          str += "<form method='POST' action='ok'>";
          str += "<tr><td><input name='ssid'  autocomplete='off'><big> Имя Wi-Fi сети";
          str += "<tr><td><input name='pswd'  autocomplete='off'><big> Пароль";
          str += "<tr><td><center><input type=SUBMIT value='Сохранить настройки'>";
          str += "</form>";
server.send ( 200, "text/html", str );
}      

void handleOk(){
  String ssid_ap;
  String pass_ap;
  unsigned char* buf = new unsigned char[64];
 
  String str = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";;
  str += "<body>";
 
  EEPROM.begin(512);
 
  ssid_ap = server.arg(0);
  pass_ap = server.arg(1);
 
  if(ssid_ap != ""){
    EEPROM.write(96,ssid_ap.length());
    EEPROM.write(97,pass_ap.length());
    ssid_ap.getBytes(buf, ssid_ap.length() + 1);
    for(byte i = 0; i < ssid_ap.length(); i++)
      EEPROM.write(i, buf[i]);
      
    pass_ap.getBytes(buf, pass_ap.length() + 1);
    for(byte i = 0; i < pass_ap.length(); i++)
      EEPROM.write(i + 32, buf[i]);
      
    EEPROM.commit();
    EEPROM.end();
/////////////////////////
    WiFi.begin(ssid_ap, pass_ap);
      // Wait for connection
      while (WiFi.status() != WL_CONNECTED){delay (500);}
 ///////////////////////////////////////////////////////////////////////////  
    str +="<big><center>Конфигурация сохранена в память<br>";
    str +="<big><center>Уберите перемычку с D1 и перезагрузите ESP8266</p><br>";
    str +="<big><b><center>";
    str += WiFi.localIP().toString();
    str +="</b><hr>";
    str +="<a href=\"/\">Return</a> to settings page</br>";
  }
  else {
    str += "<big><center>No WIFI Net</br>\
   <a href=\"/\">Return</a> to settings page</br>";
  }
  str += "</body></html>";
  server.send ( 200, "text/html", str );
}

void web0() { 
   String str0 = "<meta charset='utf-8'><meta name='viewport' content='width=480, user-scalable=no' />";
          str0 += "<center><b><big>После перезагрузки ESP8266 перейдите по <a href='./'>ссылке</a>";
          server.send (200, "text/html", str0);sumbit();
}

20

Re: ESP8266+WS2811 = часы

Приветствую форум! Подскажите пожалуйста, как изменить количество знаков и немного поправить код чтобы остались традиционные четыре цифры с двоеточием, ну и  может еще отдельный пятый знак для температуры + и - . Сам не особо силен в программировании