I have an arduino application doing two things in the loop
:
- A webserver that waits for a connection and renders some html forms to change configuration values.
- Process some external data and show them on an matrix of leds.
The problem is that the processing of the data takes much time (~20 seconds). So while this time, the webserver can't do anything. My programm structure looks like this:
EthernetServer server(80);
void loop() {
webServer()
processAndShowData();
}
void webServer() {
EthernetClient serverClient = server.available();
if (serverClient) {
while (serverClient.connected() {
// handle the web server stuff in here
}
}
}
So my question is, if there is any posibility to use a interrupt handler for handling the web server stuff? Then the web server could react while the other task is running.
UPDATE: I now also tried to attach an interrupt to the ethernet pins (using a Mega this are 50, 51 and 52), but this doesn't work too. I tried sth. like this:
attachInterrupt(50, demoFunction, CHANGE);
But the method does not get called, even when changing the pins to 51 or 52 on both, input from a client like a HTTP request and output sending HTML to a browser.