trápím se už několik dní s problémem a nemůžu nikde nic nalézt a chtěl bych proto požádat o radu. Mám hlavní arduino, které má tuto část kódu pro http stránku.
Kód: Vybrat vše
//---------------web stranka
WiFiClient client = server.available();
if (client) { //Připojil se klient?
Serial.println("new client");
boolean current_line_is_blank = true;
String buffer = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
buffer = buffer + c;
if (c == '\n' && current_line_is_blank) {
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println(""); // do not forget this one
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<head>");
client.println("<title>Teplomer Hlavni</title>");
client.println("</head>");
client.println("<body bgcolor=#f9a46f>");
client.println("<h1>TEPLOMER</h1>");
client.print("<h3>Teplota: ");
client.print(teplomer1());
client.print("°C");
client.print("</h3>");
client.print("<br>");
//SEM BYCH POTŘEBOVAL DOSTAT OBSAH STRÁNKY
client.print("http://192.168.9.25:88/");
client.print("</body>");
client.print("<meta http-equiv=\"refresh\" content=\"5\">");
client.println("</html>");
break;
}
if (c == '\n') {
current_line_is_blank = true;
} else if (c != '\r') {
current_line_is_blank = false;
}
}
}
delay(20);
client.stop();
Serial.println("Client disconnected");
Serial.println("");
}
//--------------konec web stranky
Http stránka toho jiného arduina v síti např. http://192.168.9.25:88/ vypadá takto:
Kód: Vybrat vše
<!DOCTYPE HTML>
<html>
<head>
<title>Teplomer 2</title>
</head>
<h1>TEPLOMER 2</h1>
<h3>Teplota:
22,23°C
</h3>
Doba behu pristroje: 3dny 11:10:54
<br>
</h6></body>
<meta http-equiv=\"refresh\" content=\"5\">
</html>
asi takto:
- TEPLOMER
24,12 °C
<!DOCTYPE HTML>
<html>
<head>
<title>Teplomer 2</title>
</head>
<h1>TEPLOMER 2</h1>
<h3>Teplota:
22,23°C
</h3>
Doba behu pristroje: 3dny 11:10:54
<br>
</h6></body>
<meta http-equiv=\"refresh\" content=\"5\">
</html>
- TEPLOMER
24,12 °C
<h1>TEPLOMER 2</h1>
<h3>Teplota:
22,23°C
</h3>