Hi Guys!
I am at this certain point now. Tried as i think everthing, but don´t get it. Here´s the situation:
My project is a remote/independent(gps) controlled unit, driven 6x6x6, used for wildlife surveilance. For setup & basic control i want to use a mega with onboard wifi. So far the mega works fine, but...
I did setup three webpages wich contain a few buttons and so on. No "bad" stuff actually. the compiling and upload runs with no errors. About 11% of space and 71% dynamic mem ist used. The wifi is been created and also works fine.
The problem is - as i see it - kind of memory-issue, but def not sure about that.
Wenn i f. e. change lines 238&241 to "sendHttpResponse1", the first page is loaded and runs perfect (see picture 1). As i change the lines back to "sendHttpResponse2" & "sendHttpResponse3" to access the other pages, no more button is displayed (see picture 2).
When i checked the source code in my webbrowser there was nothing left of my button code.
Does anyone have a hint, what i am doing wrong?
Kind regards,
Andy
#include <WiFiEsp.h>
#include <WiFiEspClient.h>
#include <WiFiEspServer.h>
#include <WiFiEspUdp.h>
/*
WiFiEsp example: WebServerAP
A simple web server that shows the value of the analog input
pins via a web page using an ESP8266 module.
This sketch will start an access point and print the IP address of your
ESP8266 module to the Serial monitor. From there, you can open
that address in a web browser to display the web page.
The web page will be automatically refreshed each 20 seconds.
For more details see: http://yaab-arduino.blogspot.com/p/wifiesp.html
*/
//Ausgänge Verbraucher
#define drain_20 20
#define drain_21 21 // light cabin
#define drain_22 22 // light front
#define drain_23 23 // light left
#define drain_24 24 // light right
#define drain_25 25 // light rear
#define drain_26 26 // light cam front
#define drain_27 27 // light cam pod
#define drain_28 28 // light cam front ir
#define drain_29 29 // light cam pod ir
#define drain_30 30 // light robot
#define drain_31 31
#define drain_32 32
#define drain_33 33
#define drain_34 34
#define drain_35 35
#define drain_36 36
#define drain_37 37
#define drain_38 38
#define drain_39 39
#define drain_40 40
#define drain_41 41
#define drain_42 42
#define drain_43 43
#define drain_44 44
#define drain_45 45
#define drain_46 46
#define drain_47 47
#define drain_48 48
#define drain_49 49
#define drain_50 50
#define drain_51 51
#define drain_52 52
#define drain_53 53
//Pin-Status
String drain_20_state = "off";
String drain_21_state = "off";
String drain_22_state = "off";
String drain_23_state = "off";
String drain_24_state = "off";
String drain_25_state = "off";
String drain_26_state = "off";
String drain_27_state = "off";
String drain_28_state = "off";
String drain_29_state = "off";
String drain_30_state = "off";
String drain_31_state = "off";
String drain_32_state = "off";
String drain_33_state = "off";
String drain_34_state = "off";
String drain_35_state = "off";
String drain_36_state = "off";
String drain_37_state = "off";
String drain_38_state = "off";
String drain_39_state = "off";
String drain_40_state = "off";
String drain_41_state = "off";
String drain_42_state = "off";
String drain_43_state = "off";
String drain_44_state = "off";
String drain_45_state = "off";
String drain_46_state = "off";
String drain_47_state = "off";
String drain_48_state = "off";
String drain_49_state = "off";
String drain_50_state = "off";
String drain_51_state = "off";
String drain_52_state = "off";
String drain_53_state = "off";
//buttons
String button_menu_standard = "<button style='width:75px; height:50px' class=\'button\'>";
String button_menu_highlight = "<button style='width:75px; height:50px; background-color:green; color:white' class=\'button\'>";
String button_menu_red = "<button style='width:75px; height:50px; background-color:red; color:white' class=\'button\'>";
String button_switch_standard = "<button style='width:392px; height:40px' class=\'button\'>";
String button_switch_highlight = "<button style='width:392px; height:40px; background-color:green; color:white' class=\'button\'>";
String button_switch_red = "<button style='width:392px; height:40px; background-color:red; color:white' class=\'button\'>";
String button_switch_reduced_standard = "<button style='width:193px; height:40px' class=\'button\'>";
String button_switch_reduced_highlight = "<button style='width:193px; height:40px; background-color:green; color:white' class=\'button\'>";
String button_switch_reduced_red = "<button style='width:193px; height:40px; background-color:red; color:white' class=\'button\'>";
String button2_menu_standard = "<button style='width:75px; height:50px' class=\'button button2\'>";
String button2_menu_highlight = "<button style='width:75px; height:50px; background-color:green; color:white' class=\'button button2\'>";
String button2_menu_red = "<button style='width:75px; height:50px; background-color:red; color:white' class=\'button button2\'>";
String button2_switch_standard = "<button style='width:392px; height:40px' class=\'button button2\'>";
String button2_switch_highlight = "<button style='width:392px; height:40px; background-color:green; color:white' class=\'button button2\'>";
String button2_switch_red = "<button style='width:392px; height:40px; background-color:red; color:white' class=\'button button2\'>";
String button2_switch_reduced_standard = "<button style='width:193px; height:40px' class=\'button button2\'>";
String button2_switch_reduced_highlight = "<button style='width:193px; height:40px; background-color:green; color:white' class=\'button button2\'>";
String button2_switch_reduced_red = "<button style='width:193px; height:40px; background-color:red; color:white' class=\'button button2\'>";
//other vars
int page_refresh_low = 60;
int page_refresh = 25;
int page_refresh_high = 5;
int page_selection = 1;
byte page_selected = (page_selection-1);
String page_generator = "";
String control_state = "1";
String track_state = "0";
String steering_state = "1";
String direction_state = "0";
int angle_state = 0;
int speed_state = 0;
char ssid[] = "Prowler_OBM"; // your network SSID (name)
char pass[] = "12345678"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
int reqCount = 0; // number of requests received
// Variable to store the HTTP request
String header;
//WiFiServer server(80);
WiFiEspServer server(80);
// use a ring buffer to increase speed and reduce memory allocation
RingBuffer buf(8);
void setup()
{
//Verbraucher
pinMode(drain_20, OUTPUT); digitalWrite(drain_20, LOW);
pinMode(drain_21, OUTPUT); digitalWrite(drain_21, LOW);
pinMode(drain_22, OUTPUT); digitalWrite(drain_22, LOW);
pinMode(drain_22, OUTPUT); digitalWrite(drain_22, LOW);
pinMode(drain_23, OUTPUT); digitalWrite(drain_23, LOW);
pinMode(drain_24, OUTPUT); digitalWrite(drain_24, LOW);
pinMode(drain_25, OUTPUT); digitalWrite(drain_25, LOW);
pinMode(drain_26, OUTPUT); digitalWrite(drain_26, LOW);
pinMode(drain_27, OUTPUT); digitalWrite(drain_27, LOW);
pinMode(drain_28, OUTPUT); digitalWrite(drain_28, LOW);
pinMode(drain_29, OUTPUT); digitalWrite(drain_29, LOW);
pinMode(drain_30, OUTPUT); digitalWrite(drain_30, LOW);
pinMode(drain_31, OUTPUT); digitalWrite(drain_31, LOW);
pinMode(drain_32, OUTPUT); digitalWrite(drain_32, LOW);
pinMode(drain_33, OUTPUT); digitalWrite(drain_33, LOW);
pinMode(drain_34, OUTPUT); digitalWrite(drain_34, LOW);
pinMode(drain_35, OUTPUT); digitalWrite(drain_35, LOW);
pinMode(drain_36, OUTPUT); digitalWrite(drain_36, LOW);
pinMode(drain_37, OUTPUT); digitalWrite(drain_37, LOW);
pinMode(drain_38, OUTPUT); digitalWrite(drain_38, LOW);
pinMode(drain_39, OUTPUT); digitalWrite(drain_39, LOW);
pinMode(drain_40, OUTPUT); digitalWrite(drain_40, LOW);
pinMode(drain_41, OUTPUT); digitalWrite(drain_41, LOW);
pinMode(drain_42, OUTPUT); digitalWrite(drain_42, LOW);
pinMode(drain_43, OUTPUT); digitalWrite(drain_43, LOW);
pinMode(drain_44, OUTPUT); digitalWrite(drain_44, LOW);
pinMode(drain_45, OUTPUT); digitalWrite(drain_45, LOW);
pinMode(drain_46, OUTPUT); digitalWrite(drain_46, LOW);
pinMode(drain_47, OUTPUT); digitalWrite(drain_47, LOW);
pinMode(drain_48, OUTPUT); digitalWrite(drain_48, LOW);
pinMode(drain_49, OUTPUT); digitalWrite(drain_49, LOW);
pinMode(drain_50, OUTPUT); digitalWrite(drain_50, LOW);
pinMode(drain_51, OUTPUT); digitalWrite(drain_51, LOW);
pinMode(drain_52, OUTPUT); digitalWrite(drain_52, LOW);
pinMode(drain_53, OUTPUT); digitalWrite(drain_53, LOW);
Serial.begin(115200); // initialize serial for debugging
Serial3.begin(115200); // initialize serial for ESP module
WiFi.init(&Serial3); // initialize ESP module
// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
while (true); // don't continue
}
// digitalWrite(feed_POWER, HIGH);
Serial.print("Attempting to start AP ");
Serial.println(ssid);
// uncomment these two lines if you want to set the IP address of the AP
//IPAddress localIp(192, 168, 111, 111);
//WiFi.configAP(localIp);
// start access point
status = WiFi.beginAP(ssid, 10, pass, ENC_TYPE_WPA2_PSK);
Serial.println("Access point started");
printWifiStatus();
// start the web server on port 80
server.begin();
Serial.println("Server started");
}
void loop()
{
WiFiEspClient client = server.available(); // listen for incoming clients
// typedef void (*FuncPtr)(WiFiEspClient); //typedef 'return type' (*FuncPtr)('arguments')
// FuncPtr myFunctions[]={&sendHttpResponse10, &sendHttpResponse20, &sendHttpResponse30}; //, &sendHttpResponse4, &sendHttpResponse5
if (client) { // if you get a client,
Serial.println("New client"); // print a message out the serial port
buf.init(); // initialize the circular buffer
while (client.connected()) { // loop while the client's connected
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
buf.push(c); // push it to the ring buffer
header += c;
// you got two newline characters in a row
// that's the end of the HTTP request, so send a response
if (buf.endsWith("\r\n\r\n")) {
// myFunctions[page_selected](client);
switch (page_selection) {
case 1:
page_header(client); sendHttpResponse1(client); page_footer(client);//do something when var equals 1
break;
case 2:
page_header(client); sendHttpResponse2(client); page_footer(client);//do something when var equals 2
break;
case 3:
page_header(client); sendHttpResponse3(client); page_footer(client);//do something when var equals 3
break;
default:
// if nothing else matches, do the default
// default is optional
break;
}
break;
}
}
}
// give the web browser time to receive the data
delay(100);
// Clear the header variable
header = "";
// close the connection
client.stop();
Serial.println("Client disconnected");
}
}
void printWifiStatus()
{
// print your WiFi shield's IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print where to go in the browser
Serial.println();
Serial.print("To see this page in action, connect to ");
Serial.print(ssid);
Serial.print(" and open a browser to http://");
Serial.println(ip);
Serial.println();
}
//functions for pages:
void page_header(WiFiEspClient client){
client.print(
"HTTP/1.1 200 OK\r\n"
"Content-Type: text/html\r\n"
// "Connection: close\r\n" // the connection will be closed after completion of the response
"Connection: open\r\n" // the connection will be closed after completion of the response
"Refresh: "); client.print(page_refresh); client.print("\r\n" // refresh the page automatically every 20 sec
"\r\n");
client.print("<!DOCTYPE html>");
// client.print("<html lang='en'>");
// client.print(" <head>");
// client.print(" <meta name='viewport' content='width=device-width,initial-scale=1'>");
// client.print(" <meta charset='utf-8'>");
// client.print(" <meta name='generator' content='CoffeeCup HTML Editor (www.coffeecup.com)'>");
// client.print(" <meta name='dcterms.created' content='Di, 20 Sep 2022 18:12:17 GMT'>");
// client.print(" <meta name='description' content=''>");
// client.print(" <meta name='keywords' content=''>");
// client.print(" <title>ATV-Onboard</title>");
// client.print(" <!--[if IE]>");
// client.print(" <script src='http://html5shim.googlecode.com/svn/trunk/html5.js'></script>");
// client.print(" <![endif]-->");
// client.print(" </head>");
client.print("<body>");
//navigation bar feedbeck
if (header.indexOf("GET /go/navi") >= 0) {Serial.println("Navigation zur Steuerung");page_selection = 1;}
else if (header.indexOf("GET /go/light") >= 0) {Serial.println("Navigation zu Beleuchtung");page_selection = 2;}
else if (header.indexOf("GET /go/drain") >= 0) {Serial.println("Navigation zu Verbrauchern");page_selection = 3;}
else if (header.indexOf("GET /go/state") >= 0) {Serial.println("Navigation zum System-Status");page_selection = 4;}
else if (header.indexOf("GET /go/wayp") >= 0) {Serial.println("Navigation zu Waypoints");page_selection = 5;}
}
void page_footer(WiFiEspClient client){
client.print("</body>");
client.print("</html>");
}
void sendHttpResponse1(WiFiEspClient client)
{
//unique page content begin
// button feedback
if (header.indexOf("GET /nav/gpson") >= 0) {control_state = "1";}
else if (header.indexOf("GET /nav/gpsoff") >= 0) {control_state = "2";}
else if (header.indexOf("GET /nav/manon") >= 0) {control_state = "2";}
else if (header.indexOf("GET /nav/manoff") >= 0) {control_state = "1";}
else if (header.indexOf("GET /nav/stefm") >= 0) {steering_state = "1";}
else if (header.indexOf("GET /nav/stehm") >= 0) {steering_state = "2";}
else if (header.indexOf("GET /nav/stefh") >= 0) {steering_state = "3";}
else if (header.indexOf("GET /nav/stesy") >= 0) {steering_state = "4";}
else if (header.indexOf("GET /nav/trackstart") >= 0) {track_state = "1";}
else if (header.indexOf("GET /nav/trackstop") >= 0) {track_state = "0";}
else if (header.indexOf("GET /nav/forward") >= 0) {direction_state = "1";}
else if (header.indexOf("GET /nav/reverse") >= 0) {direction_state = "2";}
else if (header.indexOf("GET /nav/acc") >= 0) {if (speed_state <= 100) {speed_state = (speed_state + 5);}}
else if (header.indexOf("GET /nav/dec") >= 0) {if (speed_state >= 5) {speed_state = (speed_state - 5);}}
else if (header.indexOf("GET /nav/left") >= 0) {if (angle_state <= 100) {angle_state = (angle_state + 5);}}
else if (header.indexOf("GET /nav/right") >= 0) {if (speed_state >= -100) {angle_state = (angle_state - 5);}}
else if (header.indexOf("GET /nav/stop") >= 0) {direction_state = "0";speed_state = 0;angle_state = 0;}
//page_refresh = 20;
// menu-bar
client.println("<a href=\'/go/navi\'>" + button_menu_highlight + "Navi</button></a>"); client.println("<a href=\'/go/light\'>" + button_menu_standard + "Licht</button></a>"); client.println("<a href=\'/go/drain\'>" + button_menu_standard + "Verbr.</button></a>"); client.println("<a href=\'/go/state\'>" + button_menu_standard + "Status</button></a>"); client.println("<a href=\'/go/wayp\'>" + button_menu_standard + "WPs</button></a></br></br>");
// page-content
client.println("<B>Navigation</B></p>");
if (control_state == "2") {
client.println("<a href=\'/nav/gpson\'>" + button_switch_reduced_standard + "GPS</button></a>");
} else {
client.println("<a href=\'/nav/gpsoff\'>" + button2_switch_reduced_highlight + "GPS</button></a>");
}
if (control_state == "1") {
client.println("<a href=\'/nav/manon\'>" + button_switch_reduced_standard + "Manuelle Steuerung</button></a></p>");
} else {
client.println("<a href=\'/nav/manoff\'>" + button2_switch_reduced_highlight + "Manuelle Steuerung</button></a></p>");
}
//gps-control
if (control_state == "1") {
if (track_state == "0") {
client.println("<a href=\'/nav/trackstart\'>" + button_switch_reduced_standard + "Starte GPS-Track</button></a></p>");
} else {
client.println("<a href=\'/nav/trackstop\'>" + button2_switch_reduced_highlight + "Track gestartet</button></a></p>");
}
}
//manual control
if (control_state == "2") {
if (direction_state == "1") {
client.println("<a href=\'/nav/reverse\'>" + button_switch_reduced_highlight + "Vorwaerts</button></a>");
} else {
client.println("<a href=\'/nav/forward\'>" + button2_switch_reduced_standard + "Vorwaerts</button></a>");
}
if (direction_state == "2") {
client.println("<a href=\'/nav/forward\'>" + button_switch_reduced_highlight + "Rueckwaerts</button></a></p>");
} else {
client.println("<a href=\'/nav/reverse\'>" + button2_switch_reduced_standard + "Rueckwaerts</button></a></p>");
}
client.println("<a href=\'/nav/acc\'>" + button_switch_standard + "Schneller (" + speed_state + "%)</button></a></p>");
client.println("<a href=\'/nav/left\'>" + button_switch_reduced_standard + "Links (" + angle_state + "%)</button></a>"); client.println("<a href=\'/nav/right\'>" + button_switch_reduced_standard + "Rechts (" + angle_state + "%)</button></a></p>");
client.println("<a href=\'/nav/dec\'>" + button_switch_standard + "Langsamer (" + speed_state + "%)</button></a></p>");
client.println("<a href=\'/nav/stop\'>" + button_switch_red + "Stop</button></a></p>");
}
client.println("</p></p><B>Lenkung</B></p>");
if (steering_state == "1") {
client.println("" + button_switch_reduced_highlight + "Front+Mitte</button>");
} else {
client.println("<a href=\'/nav/stefm\'>" + button2_switch_reduced_standard + "Front+Mitte</button></a>");
}
if (steering_state == "2") {
client.println("" + button_switch_reduced_highlight + "Heck+Mitte</button></p>");
} else {
client.println("<a href=\'/nav/stehm\'>" + button2_switch_reduced_standard + "Heck+Mitte</button></a></p>");
}
if (steering_state == "3") {
client.println("" + button_switch_reduced_highlight + "Front+Heck</button>");
} else {
client.println("<a href=\'/nav/stefh\'>" + button2_switch_reduced_standard + "Front+Heck</button></a>");
}
if (steering_state == "4") {
client.println("" + button_switch_reduced_highlight + "Synchron</button></p>");
} else {
client.println("<a href=\'/nav/stesy\'>" + button2_switch_reduced_standard + "Sychron</button></a></p>");
}
//unique page content end
}
void sendHttpResponse2(WiFiEspClient client)
{
//unique page content begin
// button feedback
if (header.indexOf("GET /21/on") >= 0) {drain_21_state = "on";digitalWrite(drain_21, HIGH);}
else if (header.indexOf("GET /21/off") >= 0) {drain_21_state = "off";digitalWrite(drain_21, LOW);}
else if (header.indexOf("GET /22/on") >= 0) {drain_22_state = "on";digitalWrite(drain_22, HIGH);}
else if (header.indexOf("GET /22/off") >= 0) {drain_22_state = "off";digitalWrite(drain_22, LOW);}
else if (header.indexOf("GET /23/on") >= 0) {drain_23_state = "on";digitalWrite(drain_23, HIGH);}
else if (header.indexOf("GET /23/off") >= 0) {drain_23_state = "off";digitalWrite(drain_23, LOW);}
else if (header.indexOf("GET /24/on") >= 0) {drain_24_state = "on";digitalWrite(drain_24, HIGH);}
else if (header.indexOf("GET /24/off") >= 0) {drain_24_state = "off";digitalWrite(drain_24, LOW);}
else if (header.indexOf("GET /25/on") >= 0) {drain_25_state = "on";digitalWrite(drain_25, HIGH);}
else if (header.indexOf("GET /25/off") >= 0) {drain_25_state = "off";digitalWrite(drain_25, LOW);}
else if (header.indexOf("GET /26/on") >= 0) {drain_28_state = "off";digitalWrite(drain_28, LOW);drain_26_state = "on";digitalWrite(drain_26, HIGH);}
else if (header.indexOf("GET /26/off") >= 0) {drain_26_state = "off";digitalWrite(drain_26, LOW);}
else if (header.indexOf("GET /27/on") >= 0) {drain_29_state = "off";digitalWrite(drain_29, LOW);drain_27_state = "on";digitalWrite(drain_27, HIGH);}
else if (header.indexOf("GET /27/off") >= 0) {drain_27_state = "off";digitalWrite(drain_27, LOW);}
else if (header.indexOf("GET /28/on") >= 0) {drain_26_state = "off";digitalWrite(drain_26, LOW);drain_28_state = "on";digitalWrite(drain_28, HIGH);}
else if (header.indexOf("GET /28/off") >= 0) {drain_28_state = "off";digitalWrite(drain_28, LOW);}
else if (header.indexOf("GET /29/on") >= 0) {drain_27_state = "off";digitalWrite(drain_27, LOW);drain_29_state = "on";digitalWrite(drain_29, HIGH);}
else if (header.indexOf("GET /29/off") >= 0) {drain_29_state = "off";digitalWrite(drain_29, LOW);}
else if (header.indexOf("GET /30/on") >= 0) {drain_30_state = "on";digitalWrite(drain_30, HIGH);}
else if (header.indexOf("GET /30/off") >= 0) {drain_30_state = "off";digitalWrite(drain_30, LOW);}
//page_refresh = 20;
//menu-bar
client.println("<a href=\'/go/navi\'>" + button_menu_standard + "Navi</button></a>"); client.println("<a href=\'/go/light\'>" + button_menu_highlight + "Licht</button></a>"); client.println("<a href=\'/go/drain\'>" + button_menu_standard + "Verbr.</button></a>"); client.println("<a href=\'/go/state\'>" + button_menu_standard + "Status</button></a>"); client.println("<a href=\'/go/wayp\'>" + button_menu_standard + "WPs</button></a></br></br>");
//page-content
if (drain_21_state == "off") {
client.println("<a href=\'/21/on\'>" + button_switch_standard + "Kabine</button></a></p>");
} else {
client.println("<a href=\'/21/off\'>" + button2_switch_highlight + "Kabine</button></a></p>");
}
if (drain_22_state == "off") {
client.println("<a href=\'/22/on\'>" + button_switch_standard + "Front</button></a></p>");
} else {
client.println("<a href=\'/22/off\'>" + button2_switch_highlight + "Front</button></a></p>");
}
if (drain_23_state == "off") {
client.println("<a href=\'/23/on\'>" + button_switch_standard + "Links</button></a></p>");
} else {
client.println("<a href=\'/23/off\'>" + button2_switch_highlight + "Links</button></a></p>");
}
if (drain_24_state == "off") {
client.println("<a href=\'/24/on\'>" + button_switch_standard + "Rechts</button></a></p>");
} else {
client.println("<a href=\'/24/off\'>" + button2_switch_highlight + "Rechts</button></a></p>");
}
if (drain_25_state == "off") {
client.println("<a href=\'/25/on\'>" + button_switch_standard + "Hinten</button></a></p>");
} else {
client.println("<a href=\'/25/off\'>" + button2_switch_highlight + "Hinten</button></a></p>");
}
if (drain_26_state == "off") {
client.println("<a href=\'/26/on\'>" + button_switch_standard + "Kamera Front</button></a></p>");
} else {
client.println("<a href=\'/26/off\'>" + button2_switch_highlight + "Kamera Front</button></a></p>");
}
if (drain_27_state == "off") {
client.println("<a href=\'/27/on\'>" + button_switch_standard + "Kamera POD</button></a></p>");
} else {
client.println("<a href=\'/27/off\'>" + button2_switch_highlight + "Kamera POD</button></a></p>");
}
if (drain_28_state == "off") {
client.println("<a href=\'/28/on\'>" + button_switch_standard + "Kamera Front IR</button></a></p>");
} else {
client.println("<a href=\'/28/off\'>" + button2_switch_highlight + "Kamera Front IR</button></a></p>");
}
if (drain_29_state == "off") {
client.println("<a href=\'/29/on\'>" + button_switch_standard + "Kamera POD IR</button></a></p>");
} else {
client.println("<a href=\'/29/off\'>" + button2_switch_highlight + "Kamera POD IR</button></a></p>");
}
if (drain_30_state == "off") {
client.println("<a href=\'/30/on\'>" + button_switch_standard + "Ausleger</button></a></p>");
} else {
client.println("<a href=\'/30/off\'>" + button2_switch_highlight + "Ausleger</button></a></p>");
}
//unique page content end
}
void sendHttpResponse3(WiFiEspClient client)
{
//unique page content begin
// button feedback
if (header.indexOf("GET /36/on") >= 0) {drain_36_state = "on";digitalWrite(drain_36, HIGH);}
else if (header.indexOf("GET /36/off") >= 0) {drain_36_state = "off";digitalWrite(drain_36, LOW);}
else if (header.indexOf("GET /37/on") >= 0) {drain_37_state = "on";digitalWrite(drain_37, HIGH);}
else if (header.indexOf("GET /37/off") >= 0) {drain_37_state = "off";digitalWrite(drain_37, LOW);}
else if (header.indexOf("GET /38/on") >= 0) { drain_38_state = "on"; digitalWrite(drain_38, HIGH);}
else if (header.indexOf("GET /38/off") >= 0) { drain_38_state = "off"; digitalWrite(drain_38, LOW);}
else if (header.indexOf("GET /39/on") >= 0) { drain_39_state = "on"; digitalWrite(drain_39, HIGH);}
else if (header.indexOf("GET /39/off") >= 0) { drain_39_state = "off"; digitalWrite(drain_39, LOW);}
else if (header.indexOf("GET /40/on") >= 0) { drain_40_state = "on"; digitalWrite(drain_40, HIGH);}
else if (header.indexOf("GET /40/off") >= 0) { drain_40_state = "off"; digitalWrite(drain_40, LOW);}
else if (header.indexOf("GET /41/on") >= 0) { drain_41_state = "off"; digitalWrite(drain_41, HIGH);}
else if (header.indexOf("GET /41/off") >= 0) { drain_41_state = "off"; digitalWrite(drain_41, LOW);}
else if (header.indexOf("GET /42/on") >= 0) { drain_42_state = "off"; digitalWrite(drain_42, HIGH);}
else if (header.indexOf("GET /42/off") >= 0) { drain_42_state = "off"; digitalWrite(drain_42, LOW);}
else if (header.indexOf("GET /43/on") >= 0) { drain_43_state = "off"; digitalWrite(drain_43, HIGH);}
else if (header.indexOf("GET /43/off") >= 0) { drain_43_state = "off"; digitalWrite(drain_43, LOW);}
else if (header.indexOf("GET /44/on") >= 0) { drain_44_state = "off"; digitalWrite(drain_44, HIGH);}
else if (header.indexOf("GET /44/off") >= 0) { drain_44_state = "off"; digitalWrite(drain_44, LOW);}
else if (header.indexOf("GET /45/on") >= 0) { drain_45_state = "on"; digitalWrite(drain_45, HIGH);}
else if (header.indexOf("GET /45/off") >= 0) { drain_45_state = "off"; digitalWrite(drain_45, LOW);}
//page_refresh = 20;
//menu-bar
client.println("<a href=\'/go/navi\'>" + button_menu_standard + "Navi</button></a>"); client.println("<a href=\'/go/light\'>" + button_menu_standard + "Licht</button></a>"); client.println("<a href=\'/go/drain\'>" + button_menu_highlight + "Verbr.</button></a>"); client.println("<a href=\'/go/state\'>" + button_menu_standard + "Status</button></a>"); client.println("<a href=\'/go/wayp\'>" + button_menu_standard + "WPs</button></a></br></br>");
//page-content
if (drain_36_state == "off") {client.println("<a href=\'/36/on\'>" + button_switch_standard + "Kamera Front</button></a></p>");
} else {client.println("<a href=\'/36/off\'>" + button2_switch_highlight + "Kamera Front</button></a></p>");}
if (drain_37_state == "off") {client.println("<a href=\'/37/on\'>" + button_switch_standard + "Kamera POD</button></a></p>");
} else {client.println("<a href=\'/37/off\'>" + button2_switch_highlight + "Kamera POD</button></a></p>");}
if (drain_38_state=="off") {
client.println("<a href=\'/38/on\'>" + button_switch_standard + "nicht_belegt</button></a></p>");
} else {client.println("<a href=\'/38/off\'>" + button2_switch_highlight + "nicht_belegt</button></a></p>");}
if (drain_39_state=="off") {
client.println("<a href=\'/39/on\'>" + button_switch_standard + "nicht_belegt</button></a></p>");
} else {client.println("<a href=\'/39/off\'>" + button2_switch_highlight + "nicht_belegt</button></a></p>");}
if (drain_40_state=="off") {
client.println("<a href=\'/40/on\'>" + button_switch_standard + "nicht_belegt</button></a></p>");
} else {client.println("<a href=\'/40/off\'>" + button2_switch_highlight + "nicht_belegt</button></a></p>");}
if (drain_41_state=="off") {
client.println("<a href=\'/41/on\'>" + button_switch_standard + "nicht_belegt</button></a></p>");
} else {client.println("<a href=\'/41/off\'>" + button2_switch_highlight + "nicht_belegt</button></a></p>");}
if (drain_42_state=="off") {
client.println("<a href=\'/42/on\'>" + button_switch_standard + "nicht_belegt</button></a></p>");
} else {client.println("<a href=\'/42/off\'>" + button2_switch_highlight + "nicht_belegt</button></a></p>");}
if (drain_43_state=="off") {
client.println("<a href=\'/43/on\'>" + button_switch_standard + "nicht_belegt</button></a></p>");
} else {client.println("<a href=\'/43/off\'>" + button2_switch_highlight + "nicht_belegt</button></a></p>");}
if (drain_44_state=="off") {
client.println("<a href=\'/44/on\'>" + button_switch_standard + "nicht_belegt</button></a></p>");
} else {client.println("<a href=\'/44/off\'>" + button2_switch_highlight + "nicht_belegt</button></a></p>");}
if (drain_44_state=="off") {
client.println("<a href=\'/45/on\'>" + button_switch_standard + "Ausleger</button></a></p>");
} else {client.println("<a href=\'/45/off\'>" + button2_switch_highlight + "Ausleger</button></a></p>");}
//unique page content end
}