Skip to content

the problem with using delay() in your code

BlackEdder edited this page Jul 14, 2017 · 2 revisions

Using delay() in your code causes the node to pause completely. This causes problems, because painlessMesh actually needs to run various tasks in the background. If these tasks are not run then the node will lose connection with the rest of the mesh.

Instead of using delay() we recommend using something the task scheduler. For an example see taskSendMessage in our basic example.

Another possible approach is highlighted here: https://playground.arduino.cc/Code/AvoidDelay