So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By btidey
#78070 I think the intention was that it continued to process the effect loop until a new 'message' arrived.

The way this is structured has 2 problems.

1) There should not be loops that do not allow the Wifi base code to execute at regular intervals otherwise a time out reset will happen. Normally this is done by ensuring the main loop code is running all the time with a maximum delay of less than a few seconds.

2) To get a new message the Webserver needs to have the server.handleClient() being called regularly. Once one of the effect loops gets control then that is no longer called so a new message can't be received.

You need to restructure it so the effects are in a state machine in the main loop not in the server.on("/" processing. You should not put a local while loop in each effect but rely on the switch statements being re-execute on each iteration of the main loop. That way the server.handleClient will be called each time round the loop; the message will get updated when a new server call is made which will then cause the different effect to get selected.
User avatar
By jme
#78076 That's correct resetClient(); should call server.handleClient().

Will try to put the code in the loop, i think i already tries it, but had issue, will test again.