Wait() or delay()
-
I take it, its better to use the wait(xx) function in my sensor program over the delay(xx);??
-
Yes.
Waiting using the Arduino delay() command is not a good idea. It halts all MySensors processing and should be avoided. Instead you should use the provided wait function which calls process() while waiting.
For details, scroll down to the headline "waiting" on http://www.mysensors.org/download/sensor_api_15
-
-
A reason for asking, is that delay() is used in a number of examples... these should all be changes to wait()..
wait() is never used in any of the examples...also, process() is NOT uses in any examples, this should be added to the loop function as a proper way to implement a loop...
-
Yes, still found in a couple of examples. Should be removed (unless they are used because no messages should be processed).
In 2.0 you shouldn't need to call process yourself. It is handled by the library.