int main() { // Enable interrupts, this is needed for every buffered UART sei(); // Create a IOStream for complex formatting tasks xpcc::IODeviceWrapper<xpcc::atmega::BufferedUart0> device(uart); xpcc::IOStream output(device); output << "Welcome" << xpcc::endl; xpcc::delay_ms(100); ow.initialize(); if (!ow.touchReset()) { output << "No devices found!" << xpcc::endl; xpcc::delay_ms(100); while (1) { // wait forever } } // search for connected DS18B20 devices ow.resetSearch(0x28); uint8_t rom[8]; while (ow.searchNext(rom)) { output << "found: " << xpcc::hex; for (uint8_t i = 0; i < 8; ++i) { output << rom[i]; } output << xpcc::ascii << xpcc::endl; xpcc::delay_ms(100); } output << "finished!" << xpcc::endl; // read the temperature from a connected DS18B20 xpcc::Ds18b20< xpcc::SoftwareOneWire<OneWirePin> > ds18b20(rom); ds18b20.startConversion(); while (1) { if (ds18b20.isConversionDone()) { int16_t temperature = ds18b20.readTemperature(); output << "Temperature: " << temperature << xpcc::endl; xpcc::delay_ms(100); ds18b20.startConversion(); } } }
void mainloop() { /////////////////// // do data logging /////////////////// if (millis() >= ulNextMeas_ms) { ds18b20(); sendTeperatureTS(temp1, temp2, temp3, temp4); ulNextMeas_ms = millis() + ulMeasDelta_ms; pfTemp1[ulMeasCount % ulNoMeasValues] = temp1; pfTemp2[ulMeasCount % ulNoMeasValues] = temp2; pfTemp3[ulMeasCount % ulNoMeasValues] = temp3; pfTemp4[ulMeasCount % ulNoMeasValues] = temp4; pulTime[ulMeasCount % ulNoMeasValues] = millis() / 1000 + ulSecs2000_timer; Serial.print("Logging Temperature1: "); Serial.print(pfTemp1[ulMeasCount % ulNoMeasValues]); Serial.print(" deg Celsius - Temperature2: "); Serial.print(pfTemp2[ulMeasCount % ulNoMeasValues]); Serial.print(" deg Celsius - Temperature3: "); Serial.print(pfTemp3[ulMeasCount % ulNoMeasValues]); Serial.print(" deg Celsius - Temperature4: "); Serial.print(pfTemp4[ulMeasCount % ulNoMeasValues]); Serial.print(" deg Celsius - Time: "); Serial.println(pulTime[ulMeasCount % ulNoMeasValues]); ulMeasCount++; } // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data Serial.println("new client"); unsigned long ultimeout = millis() + 250; while (!client.available() && (millis() < ultimeout) ) { delay(1); } if (millis() > ultimeout) { Serial.println("client connection time-out!"); return; } // Read the first line of the request String sRequest = client.readStringUntil('\r'); //Serial.println(sRequest); client.flush(); // stop client, if request is empty if (sRequest == "") { Serial.println("empty request! - stopping client"); client.stop(); return; } // get path; end of path is either space or ? // Syntax is e.g. GET /?pin=MOTOR1STOP HTTP/1.1 String sPath = "", sParam = "", sCmd = ""; String sGetstart = "GET "; int iStart, iEndSpace, iEndQuest; iStart = sRequest.indexOf(sGetstart); if (iStart >= 0) { iStart += +sGetstart.length(); iEndSpace = sRequest.indexOf(" ", iStart); iEndQuest = sRequest.indexOf("?", iStart); // are there parameters? if (iEndSpace > 0) { if (iEndQuest > 0) { // there are parameters sPath = sRequest.substring(iStart, iEndQuest); sParam = sRequest.substring(iEndQuest, iEndSpace); } else { // NO parameters sPath = sRequest.substring(iStart, iEndSpace); } } } /////////////////////////////////////////////////////////////////////////////// // output parameters to serial, you may connect e.g. an Arduino and react on it /////////////////////////////////////////////////////////////////////////////// if (sParam.length() > 0) { int iEqu = sParam.indexOf("="); if (iEqu >= 0) { sCmd = sParam.substring(iEqu + 1, sParam.length()); Serial.print("Die Eingabe ist: "); Serial.println(sCmd); } } /////////////////////////// // format the html response /////////////////////////// // Startseite //////////////////////////////// String sResponse, sResponse2, sHeader; if (sPath == "/") { ulReqcount++; int iIndex = (ulMeasCount - 1) % ulNoMeasValues; sResponse = F("<html>\n<head>\n<title>WLAN Logger für Pufferspeichertemperatur</title>\n"); sResponse += F("</head>\n<body>\n<font color=\"#000000\"><body bgcolor=\"#d0d0f0\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\"><h1>WLAN Logger für Pufferspeichertemperatur</h1>SMASE<BR><BR><FONT SIZE=+1>Letzte Messung um "); sResponse += F("Seite: Temperaturen -> Zeigt die gemessenen Temperaturen an <br>"); sResponse += F("<hr>Seite: Grafik -> Zeigt den Temperaturverlauf (Diagramm) der letzten 24 h an <br>"); sResponse += F("<hr>Seite: Grafik -> Zeigt den Temperaturverlauf (Tabelle) der letzten 24 h an <br>"); sResponse += F("<hr>Seite: Settings -> Einstellungen <br>"); sResponse += F(" <div style=\"clear:both;\"></div>"); sResponse2 = F("<p>Temperaturverlauf - Seiten laden länger:<BR> <a href=\"/anzeige\"><button>Temperaturen</button></a> <a href=\"/grafik\"><button>Grafik</button></a> <a href=\"/tabelle\"><button>Tabelle</button></a> <a href=\"/settings\"><button>Settings</button></a></p>"); sResponse2 += MakeHTTPFooter().c_str(); // Send the response to the client client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str()); client.print(sResponse); client.print(sResponse2); } if (sPath == "/anzeige") { ulReqcount++; int iIndex = (ulMeasCount - 1) % ulNoMeasValues; sResponse = F("<html>\n<head>\n<title>WLAN Logger für Pufferspeichertemperatur</title>\n<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>\n"); sResponse += F("<script type=\"text/javascript\">\ngoogle.charts.load('current', {'packages':['gauge']});\n"); sResponse += F(" google.charts.setOnLoadCallback(drawGauge); \n"); sResponse += F("\nvar gaugeOptions = {min: 0, max: 100, greenFrom: 50, greenTo:75, yellowFrom: 75, yellowTo: 90,redFrom: 90, redTo: 100, minorTicks: 10, majorTicks: ['0','10','20','30','40','50','60','70','80','90','100']};\n"); sResponse += F(" var gauge; \n"); sResponse += F(" function drawGauge() { \n"); sResponse += F(" gaugeData = new google.visualization.DataTable(); \n"); sResponse += F(" gaugeData.addColumn('number', 'oben'); \n"); sResponse += F(" gaugeData.addColumn('number', 'mitte'); \n"); sResponse += F(" gaugeData.addColumn('number', 'unten'); \n"); sResponse += F(" gaugeData.addColumn('number', 'vorlauf'); \n"); sResponse += F(" gaugeData.addRows(2); \n"); sResponse += F(" gaugeData.setCell(0, 0, "); sResponse += pfTemp1[iIndex]; sResponse += F(" ); \n"); sResponse += F(" gaugeData.setCell(0, 1, "); sResponse += pfTemp2[iIndex]; sResponse += F(" ); \n"); sResponse += F(" gaugeData.setCell(0, 2, "); sResponse += pfTemp3[iIndex]; sResponse += F(" ); \n"); sResponse += F(" gaugeData.setCell(0, 3, "); sResponse += pfTemp4[iIndex]; sResponse += F(" ); \n"); sResponse += F(" gauge = new google.visualization.Gauge(document.getElementById('gauge_div')); \n"); sResponse += F(" gauge.draw(gaugeData, gaugeOptions); \n"); sResponse += F(" } \n"); sResponse += F(" </script> \n </head> \n <body> \n<font color=\"#000000\"><body bgcolor=\"#d0d0f0\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\"><h1>WLAN Logger für Pufferspeichertemperatur</h1>SMASE<BR><BR><FONT SIZE=+1>Letzte Messung um "); sResponse += epoch_to_string(pulTime[iIndex]).c_str(); sResponse += F(" UTC<BR>\n"); sResponse += F("<fieldset><legend>Pufferspeicher</legend>"); sResponse += F(" <div id=\"gauge_div\" style=\"width:140px; height: 560px;\"></div> \n"); sResponse += F("</fieldset>"); sResponse += F(" <div style=\"clear:both;\"></div>"); sResponse2 = F("<p>Temperaturverlauf - Seiten laden länger:<BR> <a href=\"/lauf\"><button>Vorlauf</button></a> <a href=\"/grafik\"><button>Grafik</button></a> <a href=\"/tabelle\"><button>Tabelle</button></a> <a href=\"/settings\"><button>Settings</button></a></p>"); sResponse2 += MakeHTTPFooter().c_str(); // Send the response to the client client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str()); client.print(sResponse); client.print(sResponse2); } // Tabelle //////////////////////////////// else if (sPath == "/tabelle") //////////////////////////////////// // format the html page for /tabelle //////////////////////////////////// { ulReqcount++; unsigned long ulSizeList = MakeTable(&client, false); // get size of table first sResponse = F("<html><head><title>WLAN Logger für Pufferspeichertemperatur</title></head><body>"); sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">"); sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">"); sResponse += F("<h1>WLAN Logger für Pufferspeichertemperatur</h1>"); sResponse += F("<FONT SIZE=+1>"); sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Letzte Messungen im Abstand von "); sResponse += ulMeasDelta_ms; sResponse += F("ms<BR>"); // here the big table will follow later - but let us prepare the end first // part 2 of response - after the big table sResponse2 = MakeHTTPFooter().c_str(); // Send the response to the client - delete strings after use to keep mem low client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length() + ulSizeList).c_str()); client.print(sResponse); sResponse = ""; MakeTable(&client, true); client.print(sResponse2); } // Diagramm //////////////////////////////// else if (sPath == "/grafik") /////////////////////////////////// // format the html page for /grafik /////////////////////////////////// { ulReqcount++; unsigned long ulSizeList = MakeList(&client, false); // get size of list first sResponse = F("<html>\n<head>\n<title>WLAN Logger für Pufferspeichertemperatur</title>\n<script type=\"text/javascript\" src=\"https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}\"></script>\n"); sResponse += F("<script type=\"text/javascript\"> google.setOnLoadCallback(drawChart);\nfunction drawChart() {var data = google.visualization.arrayToDataTable([\n['Zeit / UTC', 'Temperatur1', 'Temperatur2', 'Temperatur3', 'Temperatur4'],\n"); // here the big list will follow later - but let us prepare the end first // part 2 of response - after the big list sResponse2 = F("]);\nvar options = {title: 'Verlauf',\n"); sResponse2 += F("curveType:'function',legend:{ position: 'bottom'}};"); sResponse2 += F("var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));chart.draw(data, options);}\n</script>\n</head>\n"); sResponse2 += F("<body>\n<font color=\"#000000\"><body bgcolor=\"#d0d0f0\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\"><h1>WLAN Logger für Pufferspeichertemperatur</h1><a href=\"/\"><button>Startseite</button></a><BR>"); sResponse2 += F("<BR>\n<div id=\"curve_chart\" style=\"width: 600px; height: 400px\"></div>"); sResponse2 += MakeHTTPFooter().c_str(); // Send the response to the client - delete strings after use to keep mem low client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length() + ulSizeList).c_str()); client.print(sResponse); sResponse = ""; MakeList(&client, true); client.print(sResponse2); } // Einstellungen //////////////////////////////// else if (sPath == "/settings") { EEPROM.begin(512); delay(10); String apiKey = ""; for (int i = 81; i < 100; i++) { //DEBUG_PRINT(i); apiKey += char(EEPROM.read(i)); } EEPROM.end(); Serial.println("Thinkspeak: " + apiKey); EEPROM.begin(512); delay(10); String zeit = ""; for (int i = 100; i < 105; i++) { zeit += char(EEPROM.read(i)); } EEPROM.end(); Serial.print("Das ist die Zeitverschiebung: "); Serial.println(zeit); String zeittext = ""; if (zeit != "0000") { zeittext = "Sommerzeit"; } else { zeittext = "Winterzeit"; } ulReqcount++; unsigned long ulSizeList = MakeTable(&client, false); // get size of table first sResponse = F("<html><head><title>WLAN Logger für Pufferspeichertemperatur</title></head><body>"); sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">"); sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">"); sResponse += F("<h1>WLAN Logger für Pufferspeichertemperatur</h1>"); sResponse += F("<FONT SIZE=+1>"); sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Thingspeak API ist momentan: "); sResponse += apiKey; sResponse += F("<BR><BR>Das ist die Zeitverschiebung: "); sResponse += zeittext; sResponse += F("<fieldset><legend>EEPROM Setting</legend>"); sResponse += F("<p><a href=\"/reset\"><button>RESET</button></a> <a href=\"?pin=FUNCTION2ON\"><button>AUSLESEN</button></a></p>"); sResponse += F("</fieldset>"); sResponse += F("<fieldset><legend>Allgemein Setting</legend>"); sResponse += F("<p>Zeitumstellung <a href=\"?pin=SOMMERZEIT\"><button>SOMMERZEIT</button></a> <a href=\"?pin=WINTERZEIT\"><button>WINTERZEIT</button></a></p>"); sResponse += F("<form name=\"input\" action=\"\" method=\"get\">THINGSPEAK-API: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>"); sResponse += F("</fieldset>"); sResponse += F("<fieldset><legend>Temperatur kalibrieren</legend>"); sResponse += F("<p><a href=\"/temp1\"><button>Speicher oben</button></a> <a href=\"/temp2\"><button>Speicher mitte</button></a> <a href=\"/temp3\"><button>Speicher unten</button></a> <a href=\"/temp4\"><button>Vorlauf</button></a></p>"); sResponse += F("</fieldset>"); sResponse2 = MakeHTTPFooter().c_str(); // Send the response to the client client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str()); client.print(sResponse); client.print(sResponse2); delay(100); ////////////////////// // react on parameters ////////////////////// if (sCmd.length() > 0) { // write received command to html page sResponse += "Kommando:" + sCmd + "<BR>"; // EEPROM RESET //////////////////////////////// if (sCmd.indexOf("FUNCTION1ON") >= 0) { EEPROM.begin(512); // write a 0 to all 512 bytes of the EEPROM for (int i = 0; i < 512; i++) { EEPROM.write(i, 0); EEPROM.end(); } } // SHOW EEPROM //////////////////////////////// else if (sCmd.indexOf("FUNCTION2ON") >= 0) { EEPROM.begin(512); delay(10); String string3 = ""; for (int i = 0; i < 150; i++) { //DEBUG_PRINT(i); string3 += char(EEPROM.read(i)); } EEPROM.end(); Serial.println(string3); } // SOMMERZEIT EINSTELLEN //////////////////////////////// else if (sCmd.indexOf("SOMMERZEIT") >= 0) { String sommer = "3600"; Serial.print("Das wird gespeichert in der seite: "); Serial.println(sommer); EEPROM.begin(512); delay(10); int si = 0; for (int i = 100; i < 105; i++) { char c; if (si < sommer.length()) { c = sommer[si]; } else { c = 0; } EEPROM.write(i, c); si++; } EEPROM.end(); Serial.println("Wrote " + sommer); } // WINTERZEIT EINSTELLEN //////////////////////////////// else if (sCmd.indexOf("WINTERZEIT") >= 0) { String winter = "0000"; Serial.print("Das wird gespeichert in der seite: "); Serial.println(winter); EEPROM.begin(512); delay(10); int si = 0; for (int i = 100; i < 105; i++) { char c; if (si < winter.length()) { c = winter[si]; } else { c = 0; } EEPROM.write(i, c); si++; } EEPROM.end(); Serial.println("Wrote " + winter); } // SET THINGSPEAK API //////////////////////////////// else { Serial.print("Das wird gespeichert in der seite: "); Serial.println(sCmd); EEPROM.begin(512); delay(10); int si = 0; for (int i = 81; i < 100; i++) { char c; if (si < sCmd.length()) { c = sCmd[si]; //DEBUG_PRINT("Wrote: "); //DEBUG_PRINT(c); } else { c = 0; } EEPROM.write(i, c); si++; } EEPROM.end(); Serial.println("Wrote " + sCmd); } } } // Kalibrieren Temperatur 1 //////////////////////////////// else if (sPath == "/temp1") //////////////////////////////////// // format the html page for /tabelle //////////////////////////////////// { EEPROM.begin(512); delay(10); String temp1k = ""; for (int i = 110; i < 115; i++) { temp1k += char(EEPROM.read(i)); } EEPROM.end(); Serial.print("Das ist die Zeitverschiebung: "); Serial.println(temp1k); // settings(); ulReqcount++; unsigned long ulSizeList = MakeTable(&client, false); // get size of table first sResponse = F("<html><head><title>WLAN Logger für Pufferspeichertemperatur</title></head><body>"); sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">"); sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">"); sResponse += F("<h1>WLAN Logger für Pufferspeichertemperatur</h1>"); sResponse += F("<FONT SIZE=+1>"); sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Speicher oben: "); sResponse += temp1k; sResponse += F("Grad C<BR>"); sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Speicher oben: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>"); sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a> <a href=\"/temp2\"><button>Speicher mitte</button></a> <a href=\"/temp3\"><button>Speicher unten</button></a> <a href=\"/temp4\"><button>Vorlauf</button></a> </p>"); sResponse2 = MakeHTTPFooter().c_str(); // Send the response to the client client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str()); client.print(sResponse); client.print(sResponse2); delay(100); ////////////////////// // react on parameters ////////////////////// if (sCmd.length() > 0) { // write received command to html page sResponse += "Kommando:" + sCmd + "<BR>"; // SET THINGSPEAK API //////////////////////////////// if (sCmd.toInt() != 0) { Serial.print("Das wird gespeichert in der seite: "); Serial.println(sCmd); EEPROM.begin(512); delay(10); int si = 0; for (int i = 110; i < 115; i++) { char c; if (si < sCmd.length()) { c = sCmd[si]; //DEBUG_PRINT("Wrote: "); //DEBUG_PRINT(c); } else { c = 0; } EEPROM.write(i, c); si++; } EEPROM.end(); Serial.println("Wrote " + sCmd); } else { Serial.println("Der Wert " + sCmd + " war keine Zahl!!!"); } } } // Kalibrieren Temperatur 2 //////////////////////////////// else if (sPath == "/temp2") //////////////////////////////////// // format the html page for /tabelle //////////////////////////////////// { EEPROM.begin(512); delay(10); String temp2k = ""; for (int i = 115; i < 120; i++) { temp2k += char(EEPROM.read(i)); } EEPROM.end(); Serial.print("Das ist die Zeitverschiebung: "); Serial.println(temp2k); // settings(); ulReqcount++; unsigned long ulSizeList = MakeTable(&client, false); // get size of table first sResponse = F("<html><head><title>WLAN Logger für Pufferspeichertemperatur</title></head><body>"); sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">"); sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">"); sResponse += F("<h1>WLAN Logger für Pufferspeichertemperatur</h1>"); sResponse += F("<FONT SIZE=+1>"); sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Speicher mitte: "); sResponse += temp2k; sResponse += F("Grad C<BR>"); sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Speicher mitte: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>"); sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a> <a href=\"/temp2\"><button>Speicher mitte</button></a> <a href=\"/temp3\"><button>Speicher unten</button></a> <a href=\"/temp4\"><button>Vorlauf</button></a> </p>"); sResponse2 = MakeHTTPFooter().c_str(); // Send the response to the client client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str()); client.print(sResponse); client.print(sResponse2); delay(100); ////////////////////// // react on parameters ////////////////////// if (sCmd.length() > 0) { // write received command to html page sResponse += "Kommando:" + sCmd + "<BR>"; // SET THINGSPEAK API //////////////////////////////// if (sCmd.toInt() != 0) { Serial.print("Das wird gespeichert in der seite: "); Serial.println(sCmd); EEPROM.begin(512); delay(10); int si = 0; for (int i = 115; i < 120; i++) { char c; if (si < sCmd.length()) { c = sCmd[si]; //DEBUG_PRINT("Wrote: "); //DEBUG_PRINT(c); } else { c = 0; } EEPROM.write(i, c); si++; } EEPROM.end(); Serial.println("Wrote " + sCmd); } else { Serial.println("Der Wert " + sCmd + " war keine Zahl!!!"); } } } // Kalibrieren Temperatur 3 //////////////////////////////// else if (sPath == "/temp3") //////////////////////////////////// // format the html page for /tabelle //////////////////////////////////// { EEPROM.begin(512); delay(10); String temp3k = ""; for (int i = 120; i < 125; i++) { temp3k += char(EEPROM.read(i)); } EEPROM.end(); Serial.print("Das ist der aktuelle Korrekturwert: "); Serial.println(temp3k); // settings(); ulReqcount++; unsigned long ulSizeList = MakeTable(&client, false); // get size of table first sResponse = F("<html><head><title>WLAN Logger für Pufferspeichertemperatur</title></head><body>"); sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">"); sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">"); sResponse += F("<h1>WLAN Logger für Pufferspeichertemperatur</h1>"); sResponse += F("<FONT SIZE=+1>"); sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Speicher unten "); sResponse += temp3k; sResponse += F("Grad C<BR>"); sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Speicher unten: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>"); sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a> <a href=\"/temp2\"><button>Speicher mitte</button></a> <a href=\"/temp3\"><button>Speicher unten</button></a> <a href=\"/temp4\"><button>Vorlauf</button></a> </p>"); sResponse2 = MakeHTTPFooter().c_str(); // Send the response to the client client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str()); client.print(sResponse); client.print(sResponse2); delay(100); ////////////////////// // react on parameters ////////////////////// if (sCmd.length() > 0) { // write received command to html page sResponse += "Kommando:" + sCmd + "<BR>"; // SET THINGSPEAK API //////////////////////////////// if (sCmd.toInt() != 0) { Serial.print("Das wird gespeichert in der seite: "); Serial.println(sCmd); EEPROM.begin(512); delay(10); int si = 0; for (int i = 120; i < 125; i++) { char c; if (si < sCmd.length()) { c = sCmd[si]; //DEBUG_PRINT("Wrote: "); //DEBUG_PRINT(c); } else { c = 0; } EEPROM.write(i, c); si++; } EEPROM.end(); Serial.println("Wrote " + sCmd); } else { Serial.println("Der Wert " + sCmd + " war keine Zahl!!!"); } } } // Kalibrieren Temperatur 4 //////////////////////////////// else if (sPath == "/temp4") //////////////////////////////////// // format the html page for /tabelle //////////////////////////////////// { EEPROM.begin(512); delay(10); String temp4k = ""; for (int i = 125; i < 130; i++) { temp4k += char(EEPROM.read(i)); } EEPROM.end(); Serial.print("Das ist die Zeitverschiebung: "); Serial.println(temp4k); // settings(); ulReqcount++; unsigned long ulSizeList = MakeTable(&client, false); // get size of table first sResponse = F("<html><head><title>WLAN Logger für Pufferspeichertemperatur</title></head><body>"); sResponse += F("<font color=\"#000000\"><body bgcolor=\"#d0d0f0\">"); sResponse += F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">"); sResponse += F("<h1>WLAN Logger für Pufferspeichertemperatur</h1>"); sResponse += F("<FONT SIZE=+1>"); sResponse += F("<a href=\"/\"><button>Startseite</button></a><BR><BR>Anpassung Vorlauf: "); sResponse += temp4k; sResponse += F("Grad C<BR>"); sResponse += F("<form name=\"input\" action=\"\" method=\"get\">Vorlauf: <input type=\"text\" name=\"$\"><input type=\"submit\" value=\"Submit\"></form>"); sResponse += F("<p>Temperatur kalibrieren: <a href=\"/temp1\"><button>Speicher oben</button></a> <a href=\"/temp2\"><button>Speicher mitte</button></a> <a href=\"/temp3\"><button>Speicher unten</button></a> <a href=\"/temp4\"><button>Vorlauf</button></a> </p>"); sResponse2 = MakeHTTPFooter().c_str(); // Send the response to the client client.print(MakeHTTPHeader(sResponse.length() + sResponse2.length()).c_str()); client.print(sResponse); client.print(sResponse2); delay(100); ////////////////////// // react on parameters ////////////////////// if (sCmd.length() > 0) { // write received command to html page sResponse += "Kommando:" + sCmd + "<BR>"; // SET THINGSPEAK API //////////////////////////////// if (sCmd.toInt() != 0) { Serial.print("Das wird gespeichert in der seite: "); Serial.println(sCmd); EEPROM.begin(512); delay(10); int si = 0; for (int i = 125; i < 130; i++) { char c; if (si < sCmd.length()) { c = sCmd[si]; //DEBUG_PRINT("Wrote: "); //DEBUG_PRINT(c); } else { c = 0; } EEPROM.write(i, c); si++; } EEPROM.end(); Serial.println("Wrote " + sCmd); } else { Serial.println("Der Wert " + sCmd + " war keine Zahl!!!"); } } } // Send the response to the client client.print(sHeader); client.print(sResponse); // and stop the client client.stop(); Serial.println("Client disconnected"); }
LOCAL void ICACHE_FLASH_ATTR ds18b20_cb(void *arg) { ds18b20(); }/**/