I'm trying to shorten my Arduino code but I've run into a problem. Here is the code snippet:
server.on("/temperature1", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", readDSTemperature1().c_str());
});
Can I use a for loop for change the 1 to 2, 3,... until 7? Otherwise I need to write that block 6 more times. The "/temperature1"
is just a string so adding + i
would work. The problem is in the readDSTemperature1
method, where I can't apply that.
I'm just a beginner at Arduino so maybe I'm missing something.
Can anyone help me further?
Fixed by using the ESP8266WebServer
library instead of the ESPAsyncWebServer
library.