Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void WebServer()
- {
- WiFiClient client = server.available(); // Listen for incoming clients
- if (client)
- { // If a new client connects,
- //Serial.println("New Client."); // print a message out in the serial port
- String currentLine = ""; // make a String to hold incoming data from the client
- currentTime = millis();
- previousTime = currentTime;
- while (client.connected() && currentTime - previousTime <= timeoutTime)
- { // loop while the client's connected
- currentTime = millis();
- if (client.available())
- { // if there's bytes to read from the client,
- char c = client.read(); // read a byte, then
- Serial.write(c); // print it out the serial monitor
- header += c;
- if (c == '\n')
- { // if the byte is a newline character
- // if the current line is blank, you got two newline characters in a row.
- // that's the end of the client HTTP request, so send a response:
- if (currentLine.length() == 0)
- {
- // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
- // and a content-type so the client knows what's coming, then a blank line:
- client.println("HTTP/1.1 200 OK");
- client.println("Content-type:text/html");
- client.println("Connection: close");
- client.println();
- // Defing redirections
- if (header.indexOf("GET /forcentp") >= 0)
- {
- NTPtime();
- }
- if (header.indexOf("GET /hred") >= 0)
- {
- colorH = 0xff0000; //
- color_H = "Red";
- Show();
- }
- if (header.indexOf("GET /hgreen") >= 0)
- {
- colorH = 0x00ff00; //
- color_H = "Green";
- Show();
- }
- if (header.indexOf("GET /hblue") >= 0)
- {
- colorH = 0x0000ff;
- color_H = "Blue";
- Show();
- }
- if (header.indexOf("GET /hgreygreen") >= 0)
- {
- colorH = 0x4d6b53; // GreyGreen
- color_H = "GreyGreen";
- Show();
- }
- if (header.indexOf("GET /hgold") >= 0)
- {
- colorH = 0xffd700; // Gold
- color_H = "Gold";
- Show();
- }
- if (header.indexOf("GET /kred") >= 0)
- {
- colorK = 0xff0000; //
- color_K = "Red";
- Show();
- }
- if (header.indexOf("GET /kgreen") >= 0)
- {
- colorK = 0x00ff00; //
- color_K = "Green";
- Show();
- }
- if (header.indexOf("GET /kblue") >= 0)
- {
- colorK = 0x0000ff;
- color_K = "Blue";
- Show();
- }
- if (header.indexOf("GET /kgreygreen") >= 0)
- {
- colorK = 0x4d6b53; // GreyGreen
- color_K = "GreyGreen";
- Show();
- }
- if (header.indexOf("GET /kgold") >= 0)
- {
- colorK = 0xffd700; // Gold
- color_K = "Gold";
- Show();
- }
- if (header.indexOf("GET /kwhite") >= 0)
- {
- colorK = 0xffffff; // White
- color_K = "White";
- Show();
- }
- if (header.indexOf("GET /mred") >= 0)
- {
- colorM = 0xff0000; //
- color_M = "Red";
- Show();
- }
- if (header.indexOf("GET /mgreen") >= 0)
- {
- colorM = 0x00ff00; //
- color_M = "Green";
- Show();
- }
- if (header.indexOf("GET /mblue") >= 0)
- {
- colorM = 0x0000ff;
- color_M = "Blue";
- Show();
- }
- if (header.indexOf("GET /mgreygreen") >= 0)
- {
- colorM = 0x4d6b53; // GreyGreen
- color_M = "GreyGreen";
- Show();
- }
- if (header.indexOf("GET /mgold") >= 0)
- {
- colorM = 0xffd700; // Gold
- color_M = "Gold";
- Show();
- }
- if (header.indexOf("GET /sred") >= 0)
- {
- colorS = 0xff0000; //
- color_S = "Red";
- Show();
- }
- if (header.indexOf("GET /sgreen") >= 0)
- {
- colorS = 0x00ff00; //
- color_S = "Green";
- Show();
- }
- if (header.indexOf("GET /sblue") >= 0)
- {
- colorS = 0x0000ff;
- color_S = "Blue";
- Show();
- }
- if (header.indexOf("GET /sgreygreen") >= 0)
- {
- colorS = 0x4d6b53; // GreyGreen
- color_S = "GreyGreen";
- Show();
- }
- if (header.indexOf("GET /sgold") >= 0)
- {
- colorS = 0xffd700; // Gold
- color_S = "Gold";
- Show();
- }
- if (header.indexOf("GET /swhite") >= 0)
- {
- colorS = 0xffffff; // White
- color_S = "White";
- Show();
- }
- if (header.indexOf("GET /mwhite") >= 0)
- {
- colorM = 0xffffff; // White
- color_M = "White";
- Show();
- }
- if (header.indexOf("GET /hwhite") >= 0)
- {
- colorH = 0xffffff; // White
- color_H = "White";
- Show();
- }
- if (header.indexOf("GET /seth") >= 0)
- {
- old_mode = clock_mode;
- FastLED.clear();
- clock_mode = 4;
- }
- if (header.indexOf("GET /setm") >= 0)
- {
- old_mode = clock_mode;
- FastLED.clear();
- clock_mode = 5;
- }
- if (header.indexOf("GET /sets") >= 0)
- {
- old_mode = clock_mode;
- FastLED.clear();
- clock_mode = 6;
- }
- if (header.indexOf("GET /done") >=0)
- {
- done();
- }
- if (header.indexOf("GET /watchdog") >= 0)
- {
- feedDog();
- }
- if (header.indexOf("GET /secson") >= 0)
- {
- effectThree();
- old_mode = clock_mode;
- clock_mode = 0;
- }
- if (header.indexOf("GET /blink") >= 0)
- {
- effectThree();
- old_mode = clock_mode;
- clock_mode = 12;
- }
- if (header.indexOf("GET /secsoff") >= 0)
- {
- effectOne();
- old_mode = clock_mode;
- for (int i = 0; i < (sizeof(allSecs)); i++)
- {
- leds[allSecs[i]] = CRGB::Black;
- }
- clock_mode = 1;
- }
- if (header.indexOf("GET /brplus") >= 0) //
- {
- bright = bright + 5;
- Serial.println(bright);
- FastLED.setBrightness(bright);
- }
- if (header.indexOf("GET /brmin") >= 0) //
- {
- bright = bright - 5;
- Serial.println(bright);
- FastLED.setBrightness(bright);
- }
- if (header.indexOf("GET /summer") >= 0)
- {
- dls = 1;
- timeClient.setTimeOffset(7200); // Set offset time in seconds to adjust for your timezone, for example: GMT +1 = 3600, GMT -1 = -3600
- NTPtime();
- }
- if (header.indexOf("GET /winter") >= 0)
- {
- dls = 0;
- timeClient.setTimeOffset(3600); // Set offset time in seconds to adjust for your timezone, for example: GMT +1 = 3600, GMT -1 = -3600
- NTPtime();
- }
- if (header.indexOf("GET /erroron") >= 0)
- {
- effectThree();
- old_mode = clock_mode;
- clock_mode = 2;
- }
- if (header.indexOf("GET /erroroff") >= 0)
- {
- effectOne();
- /*
- for (int i = 0; i < (sizeof(err)); i++)
- {
- leds[err[i]] = CRGB::Black;
- }
- */
- clock_mode = old_mode;
- //NTPtime();
- }
- if (header.indexOf("GET /showip") >= 0)
- {
- old_mode = clock_mode;
- counter = 0;
- effectThree();
- //showip();
- clock_mode = 3;
- }
- if (header.indexOf("GET /test") >= 0)
- {
- old_mode = clock_mode;
- effectThree();
- clock_mode = 9;
- }
- /*
- if (header.indexOf("GET /border") >= 0)
- {
- old_mode = clock_mode;
- effectThree();
- clock_mode = 10;
- }
- */
- if (header.indexOf("GET /date") >= 0)
- {
- old_mode = clock_mode;
- effectOne();
- clock_mode = 10;
- }
- if (header.indexOf("GET /time") >= 0)
- {
- old_mode = clock_mode;
- effectOne();
- clock_mode = 13;
- }
- if (header.indexOf("GET /nightHr-") >= 0)
- {
- nightHr --;
- if (nightHr < 0)
- {
- nightHr = 23;
- }
- }
- if (header.indexOf("GET /nightHr+") >= 0)
- {
- nightHr ++;
- if (nightHr > 23)
- {
- nightHr = 0;
- }
- }
- if (header.indexOf("GET /nightMin-") >= 0)
- {
- nightMin = nightMin - 15;
- if (nightMin <= -1)
- {
- nightMin = 45;
- }
- }
- if (header.indexOf("GET /nightMin+") >= 0)
- {
- nightMin = nightMin + 15;
- if (nightMin >= 59)
- {
- nightMin = 0;
- }
- }
- if (header.indexOf("GET /dayHr-") >= 0)
- {
- dayHr --;
- if (dayHr < 0)
- {
- dayHr = 23;
- }
- }
- if (header.indexOf("GET /dayHr+") >= 0)
- {
- dayHr ++;
- if (dayHr > 23)
- {
- dayHr = 0;
- }
- }
- if (header.indexOf("GET /dayMin-") >= 0)
- {
- dayMin = dayMin - 15;
- if (dayMin <= -1)
- {
- dayMin = 45;
- }
- }
- if (header.indexOf("GET /dayMin+") >= 0)
- {
- dayMin = dayMin + 15;
- if (dayMin >= 59)
- {
- dayMin = 0;
- }
- }
- if (header.indexOf("GET /hourplus") >= 0)
- {
- h = h + 1;
- }
- if (header.indexOf("GET /hourmin") >= 0)
- {
- h = h - 1;
- }
- if (header.indexOf("GET /minuteplus") >= 0)
- {
- m = m + 1;
- }
- if (header.indexOf("GET /minuteplus") >= 0)
- {
- m = m + 1;
- }
- if (header.indexOf("GET /titleoff") >= 0)
- {
- title = 0;
- }
- if (header.indexOf("GET /titleon") >= 0)
- {
- title = 1;
- }
- // color picker
- if (header.indexOf("GET /HOUR?r") >= 0)
- {
- pos1 = header.indexOf('r');
- pos2 = header.indexOf('g');
- pos3 = header.indexOf('b');
- pos4 = header.indexOf('&');
- redString = header.substring(pos1+1, pos2);
- greenString = header.substring(pos2+1, pos3);
- blueString = header.substring(pos3+1, pos4);
- re = redString.toInt();
- gr = greenString.toInt();
- bl = blueString.toInt();
- Serial.print("R: ");
- Serial.println(re, HEX);
- Serial.print("G: ");
- Serial.println(gr, HEX);
- Serial.print("B: ");
- Serial.println(bl, HEX);
- String rgb = String(re, HEX) + String(gr, HEX) + String(bl, HEX);
- Serial.print("rgb: ");
- Serial.println(rgb);
- long RGB = (re << 16) | (gr << 8) | bl;
- Serial.print("RGB: ");
- Serial.println(RGB);
- colorH = RGB;
- Serial.print("colorH: ");
- Serial.println(colorH);
- }
- if (header.indexOf("GET /MIN?r") >= 0)
- {
- pos1 = header.indexOf('r');
- pos2 = header.indexOf('g');
- pos3 = header.indexOf('b');
- pos4 = header.indexOf('&');
- redString = header.substring(pos1+1, pos2);
- greenString = header.substring(pos2+1, pos3);
- blueString = header.substring(pos3+1, pos4);
- re = redString.toInt();
- gr = greenString.toInt();
- bl = blueString.toInt();
- Serial.print("R: ");
- Serial.println(re, HEX);
- Serial.print("G: ");
- Serial.println(gr, HEX);
- Serial.print("B: ");
- Serial.println(bl, HEX);
- String rgb = String(re, HEX) + String(gr, HEX) + String(bl, HEX);
- Serial.print("rgb: ");
- Serial.println(rgb);
- long RGB = (re << 16) | (gr << 8) | bl;
- Serial.print("RGB: ");
- Serial.println(RGB);
- colorM = RGB;
- Serial.print("colorM: ");
- Serial.println(colorM);
- }
- if (header.indexOf("GET /SEC?r") >= 0)
- {
- pos1 = header.indexOf('r');
- pos2 = header.indexOf('g');
- pos3 = header.indexOf('b');
- pos4 = header.indexOf('&');
- redString = header.substring(pos1+1, pos2);
- greenString = header.substring(pos2+1, pos3);
- blueString = header.substring(pos3+1, pos4);
- re = redString.toInt();
- gr = greenString.toInt();
- bl = blueString.toInt();
- Serial.print("R: ");
- Serial.println(re, HEX);
- Serial.print("G: ");
- Serial.println(gr, HEX);
- Serial.print("B: ");
- Serial.println(bl, HEX);
- String rgb = String(re, HEX) + String(gr, HEX) + String(bl, HEX);
- Serial.print("rgb: ");
- Serial.println(rgb);
- long RGB = (re << 16) | (gr << 8) | bl;
- Serial.print("RGB: ");
- Serial.println(RGB);
- colorS = RGB;
- Serial.print("colorS: ");
- Serial.println(colorS);
- }
- // color picker
- if(header.indexOf("GET /bright") >= 0)
- {
- pos1 = header.indexOf('t');
- pos2 = header.indexOf('&');
- valueString = header.substring(pos1+1, pos2);
- //Serial.println("Start:");
- //Serial.println(pos1); // -1
- //Serial.println(valueString); // 210
- bright = valueString.toInt();
- FastLED.setBrightness(bright);
- //Serial.println("Done.");
- }
- // Display the HTML web page
- client.println("<!DOCTYPE html><html>");
- client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
- client.println("<link rel=\"icon\" href=\"data:,\">");
- //client.println("<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">");
- client.println("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jscolor/2.0.4/jscolor.min.js\">");
- //client.println("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jscolor/2.4.8/jscolor.min.js\">");
- client.println("<style><input data-jscolor=\"{position:'top'}\"></style></script>"); //https://jscolor.com/examples/
- // client.println("<style=\"position:absolute; left:280px; top:10px;\"> toHEXString = <span id=\"hex-str\"></span><br /> toRGBString = <span id=\"rgb-str\"></span><br /> R, G, B = <span id=\"rgb\"></span><br /> H, S, V = <span id=\"hsv\"></span>");
- client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
- client.println(".button { background-color: #195B6A; border: none; color: white; padding: 10px;");
- client.println("text-decoration: none; font-size: 20px; margin: 2px; cursor: pointer; width: 100px; border-radius: 12px;}");
- client.println(".button2 { background-color: #195B6A; border: none; color: black; padding: 10px;}");
- client.println(".button3 { background-color: #FFFF00; border: none; color: black; padding: 10px;");
- client.println("text-decoration: none; font-size: 20px; margin: 2px; cursor: pointer; height: 40px; width: 100px; border-radius: 12px;}");
- client.println(".button4 { background-color: #0000FF; border: none; color: black; padding: 10px;");
- client.println("text-decoration: none; font-size: 20px; margin: 2px; cursor: pointer; height: 40px; width: 100px; border-radius: 12px;}");
- client.println(".button5 { background-color: #00FF00; border: none; color: black; padding: 10px;");
- client.println("text-decoration: none; font-size: 20px; margin: 2px; cursor: pointer; height: 40px; width: 100px; border-radius: 12px;}");
- client.println(".button6 { background-color: #FF0000; border: none; color: black; padding: 10px;");
- client.println("text-decoration: none; font-size: 20px; margin: 2px; cursor: pointer; height: 40px; width: 100px; border-radius: 12px;}");
- client.println(".button7 { background-color: #FFFFFF; border: none; color: black; padding: 10px;");
- client.println("text-decoration: none; font-size: 20px; margin: 2px; cursor: pointer; height: 40px; width: 100px; border-radius: 12px;}");
- client.println(".button8 { background-color: #F0F3F4; border: none; color: black; padding: 10px;");
- client.println("text-decoration: none; font-size: 20px; margin: 2px; cursor: pointer; height: 40px; width: 100px; border-radius: 12px;}");
- //client.println("<meta http-equiv=\"refresh\" content=\"1\">");
- client.println("</style></head>");
- // Web Page Heading
- client.println("<body style='background-color: #77878A; text-color: yellow'><h1>Clock settings page</h1>");
- // Display current settings and clock modes
- client.print("<h2>Time: ");
- client.print(h);
- client.print(":");
- if (m <10)
- {
- client.print("0");
- }
- client.print(m);
- client.print(":");
- if (s <10)
- {
- client.print("0");
- }
- client.print(s);
- client.print(" | ");
- client.print("Date: ");
- client.print(Day);
- client.print("-");
- client.print(Month);
- client.print("-");
- client.print(Year);
- client.print("<br>");
- client.print("Dim time: ");
- client.print(nightHr);
- client.print(":");
- if (nightMin < 10)
- {
- client.print("0");
- }
- client.print(nightMin);
- client.print(" | Back to normal: ");
- client.print(dayHr);
- client.print(":");
- if (dayMin < 10)
- {
- client.print("0");
- }
- client.print(dayMin);
- client.println("</h2>");
- client.print("Uptime: ");
- client.print(uptime::getDays());
- client.print(" days, ");
- client.print(uptime::getHours());
- client.print(" hours, ");
- client.print(uptime::getMinutes());
- client.print(" minutes, Startup reason: ");
- client.println(ESP.getResetReason());
- client.println("<br>");
- client.print("Last NTP update: ");
- client.print(updHour);
- client.print(":");
- if (updMinute < 10)
- {
- client.print("0");
- }
- client.print(updMinute);
- client.print(":");
- if (updSecond < 10)
- {
- client.print("0");
- }
- client.print(updSecond);
- client.print(" | Dog last fed at: ");
- client.print(fedH);
- client.print(":");
- if (fedM < 10)
- {
- client.print("0");
- }
- client.print(fedM);
- client.print(":");
- if (fedS < 10)
- {
- client.print("0");
- }client.print(fedS);
- client.print(" / ");
- client.print(fedDD);
- client.print("-");
- client.print(fedMM);
- client.print("-");
- client.println(Year);
- client.println("<br><br>");
- // Color picker
- client.println("<table style=\"width:50%; margin-left:auto; margin-right:auto\">");
- client.println("</table>");
- client.println("<br><br>");
- // Color picker
- client.println("<table style=\"width:50%; margin-left:auto; margin-right:auto\">");
- client.println("<tr>");
- /*
- client.println("<td><label for=\"colorpicker\">Hour</label>");
- client.println("<input type=\"color\" id=\"colorpicker\" value=\"#000000\"></td>");
- */
- /*
- client.println("<td><input name=\"color\" class=\"color{onImmediateChange:'updateInfo(this);'}\" value=\"000000\" size=\"9\"><input type=\"hidden\" id=\"info-r\" name=\"colorr\"/><input type=\"hidden\" id=\"info-g\" name=\"colorg\"/><input type=\"hidden\" id=\"info-b\" name=\"colorb\"/>");
- client.println("<script type=\"text/javascript\"> function updateInfo(color) {document.getElementById('info-r').value = color.rgb[0];document.getElementById('info-g').value = color.rgb[1]; document.getElementById('info-b').value = color.rgb[2];} </script></td>");
- */
- client.println("<td><h2>Colors</h2></td>");
- /*
- client.println("<td><a class =\"button\" href=\"#\" id=\"change_hour\" role=\"button\"></a></td>");
- client.println("<td><input class=\"jscolor\" href=\"#\" id=\"btnPicker\" type=\"button\">Hour</td>");
- client.println("<script>function updateColor(picker) {document.getElementById('rgb').innerHTML = Math.round(picker.rgb[0]) + ', ' + Math.round(picker.rgb[1]) + ', ' + Math.round(picker.rgb[2]);}");
- //client.println("document.getElementById('btnPicker').addEventListener('change', function(e){updateColor(this.jscolor)})</script>");
- client.println("document.getElementById(\"btnPicker\").href=\"HOUR?r\" + Math.round(picker.rgb[0]) + \"g\" + Math.round(picker.rgb[1]) + \"b\" + Math.round(picker.rgb[2]) + \"&\";}</script>");
- */
- client.println("<div class=\"container1\"><div class=\"row\"</div>");
- client.println("<td><a class =\"button\" href=\"#\" id=\"change_hour\" role=\"button\">Hour</a></td>");
- client.println("<td><input class=\"jscolor {onFineChange:'update(this)'}\" id=\"rgbH\"></div></td>");
- client.println("<script>function update1(picker) {document.getElementById('rgbH').innerHTML = Math.round(picker.rgb[0]) + ', ' + Math.round(picker.rgb[1]) + ', ' + Math.round(picker.rgb[2]);");
- client.println("document.getElementById(\"change_hour\").href=\"HOUR?r\" + Math.round(picker.rgb[0]) + \"g\" + Math.round(picker.rgb[1]) + \"b\" + Math.round(picker.rgb[2]) + \"&\";}</script>");
- client.println("<div class=\"container2\"><div class=\"row2\"</div>");
- client.println("<td><a class =\"button\" href=\"#\" id=\"change_min\" role=\"button\">Min</a></td>");
- client.println("<td><input class=\"jscolor {onFineChange:'update(this)'}\" id=\"rgbM\"></div></td>");
- client.println("<script>function update2(picker1) {document.getElementById('rgbM').innerHTML = Math.round(picker1.rgb[0]) + ', ' + Math.round(picker1.rgb[1]) + ', ' + Math.round(picker1.rgb[2]);");
- client.println("document.getElementById(\"change_min\").href=\"MIN?r\" + Math.round(picker1.rgb[0]) + \"g\" + Math.round(picker1.rgb[1]) + \"b\" + Math.round(picker1.rgb[2]) + \"&\";}</script>");
- client.println("<div class=\"container3\"><div class=\"row3\"</div>");
- client.println("<td><a class =\"button\" href=\"#\" id=\"change_sec\" role=\"button\">Sec</a></td>");
- client.println("<td><input class=\"jscolor {onFineChange:'update(this)'}\" id=\"rgbS\"></div></td>");
- client.println("<script>function update3(picker2) {document.getElementById('rgbS').innerHTML = Math.round(picker2.rgb[0]) + ', ' + Math.round(picker2.rgb[1]) + ', ' + Math.round(picker2.rgb[2]);");
- client.println("document.getElementById(\"change_sec\").href=\"SEC?r\" + Math.round(picker2.rgb[0]) + \"g\" + Math.round(picker2.rgb[1]) + \"b\" + Math.round(picker2.rgb[2]) + \"&\";}</script>");
- client.println("</tr>");
- client.println("<tr>");
- client.println("<td><h2>Options</h2></td>");
- //client.println("<td><input type=\"radio\" id=\"Summer\" label=\"Summer\" value=\"Summer\" onclick=\"javascript:window.location.href='/summer'; return true;\" /></td>");
- if (dls == 0)
- {
- client.println("<td><a href=\"/summer\"><button class=\"button\">Summer</button></a></td>");
- }
- else
- {
- client.println("<td><a href=\"/summer\"><button class=\"button button2\">Summer</button></a></td>");
- }
- if (dls == 1)
- {
- client.println("<td><a href=\"/winter\"><button class=\"button\">Winter</button></a></td>");
- }
- else
- {
- client.println("<td><a href=\"/winter\"><button class=\"button button2\">Winter</button></a></td>");
- }
- client.println("<td><a href=\"/forcentp\"><button class=\"button\">NTP</button></a></td>");
- if (clock_mode == 0)
- {
- client.println("<td><a href=\"/secson\"><button class=\"button button2\">SecsOn</button></a></td>");
- }
- else
- {
- client.println("<td><a href=\"/secson\"><button class=\"button\">SecsOn</button></a></td>");
- }
- if (clock_mode == 1)
- {
- client.println("<td><a href=\"/secsoff\"><button class=\"button button2\">SecsOff</button></a></td>");
- }
- else
- {
- client.println("<td><a href=\"/secsoff\"><button class=\"button\">SecsOff</button></a></td>");
- }
- if (clock_mode == 12)
- {
- client.println("<td><a href=\"/blink\"><button class=\"button button2\">Blink</button></a></td>");
- }
- else
- {
- client.println("<td><a href=\"/blink\"><button class=\"button\">Blink</button></a></td>");
- }
- client.println("</tr>");
- client.println("<tr>");
- client.println("<td><a href=\"#\" id=\"change_bright\" class=\"button\">Bright</button></a></td>");
- client.println("<td><input type='range' name=slider1 min='0' max='255' step='5' value=");
- client.println(bright);
- client.println("oninput='showValue1(this.value)'>");
- client.println("<span id='bright'></span></td>");
- client.println("<script>function showValue1(newValue) {document.getElementById('bright').innerHTML = newValue;");
- client.println("document.getElementById(\"change_bright\").href=\"bright\" + newValue + \"&\";}</script>");
- client.print("<td><h2> BR: ");
- client.print(bright);
- client.println("</h2></td>");
- client.println("<td><a href=\"/watchdog\"><button class=\"button\">Watchdog</button></a></td>");
- if (title == 0)
- {
- client.println("<td><a href=\"/titleon\"><button class=\"button\">Title</button></a></td>");
- }
- else
- {
- client.println("<td><a href=\"/titleoff\"><button class=\"button button2\">Title</button></a></td>");
- }
- client.println("<td><a href=\"https://www.spookjuh.nl/woordklok-2022/\"><button class=\"button button2\">Manual</button></a></td>");
- client.println("</tr>");
- client.println("</table>");
- client.println("<table style=\"width:50%; margin-left:auto; margin-right:auto\">");
- client.println("<tr>");
- client.println("<td><h2>Night time</h2></td>");
- client.println("<td><a href=\"/nightHr-\"><button class=\"button\">Hr -</button></a></td>");
- client.println("<td><a href=\"/nightHr+\"><button class=\"button\">Hr +</button></a></td>");
- client.println("<td><a href=\"/nightMin-\"><button class=\"button\">Min -</button></a></td>");
- client.println("<td><a href=\"/nightMin+\"><button class=\"button\">Min +</button></a></td>");
- client.println("</tr>");
- client.println("<tr>");
- client.println("<td><h2>Day time</h2></td>");
- client.println("<td><a href=\"/dayHr-\"><button class=\"button\">Hr -</button></a></td>");
- client.println("<td><a href=\"/dayHr+\"><button class=\"button\">Hr +</button></a></td>");
- client.println("<td><a href=\"/dayMin-\"><button class=\"button\">Min -</button></a></td>");
- client.println("<td><a href=\"/dayMin+\"><button class=\"button\">Min +</button></a></td>");
- client.println("</tr>");
- client.println("</table>");
- client.println("<br>");
- //client.println("<a href=\"/reboot\"><button class=\"button button2\">Reboot</button></a>");
- client.print("<br>");
- client.print("Filename: ");
- client.println(Filename);
- client.print(" | Mem heap: ");
- client.println(ESP.getFreeHeap());
- client.println("</body></html>");
- // The HTTP response ends with another blank line
- client.println();
- // Break out of the while loop
- break;
- }
- else
- { // if you got a newline, then clear currentLine
- currentLine = "";
- }
- }
- else if (c != '\r')
- { // if you got anything else but a carriage return character,
- currentLine += c; // add it to the end of the currentLine
- }
- }
- }
- // Clear the header variable
- header = "";
- // Close the connection
- client.stop();
- //Serial.println("Client disconnected.");
- //Serial.println("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement