liudr:
zoomkat:
I suggest you put the web server code in the main loop, and put the bot control code in conditional functions. Any significant delays need to check current time vs past time to avoid delays in program execution.I don't think so. If the web browser misbehaves etc. then the connection will stay alive over a period of time too long for the robot to roam without sensing its environment. As I suggested already, OP should use state machine to take in each client byte at a time and NOT to run the server code like nothing else matters!
The arduino web servers are fairly robust when being connected to a well designed browser client. The OP's server code apparently runs on its own without issues. Adding the robot activities appear to be where the issues start. For trouble shooting I usually start with code that is known to work and slowly add discrete portions of new code until the code fails. For this project I'd start with the web server as the basic operation and then add a single bot activity at a time to the code and see if the combined code fails after a specific addition. Finding the point of failure is key to finding why the failure is occurring.