Does Gateway loop() required Wait or delay?
-
Hi,
I have a functioning sensebender gateway with one sensor. The sensor is just counting and being used for my 1st system learning.
My gateway does nothing else but be a gateway. In this configuration do I need a Wait(xx) or delay(xx) in the gateway loop()?
Early on I thought I read a delay was needed else a lot of unneeded traffic was generated by the gateway, but now I can't find that statement and the examples have no delay in the loop() function.
Thanks
-
@johnrob using delay can cause the gateway to miss messages. Use wait.
I've never seen anything about unnecessary traffic, and I can't imagine how that could happen. Do you have any more information?
-
Hi,
@mfalkviddNo I don't, when I first started learning MySensors (not too long ago) I was reading a lot of the website information and posts and whatever. I had the impression an empty loop() routine could be an issue but I must have mixed up what I read on something else. And not really understanding the inner workings of the MySensors code I figured I would ask before I removed the wait(2000) I have.
So do you recommend nothing or wait(2000) as I have now?
Thanks
John
-
@johnrob I'd remove wait. Less code makes the code easier to read.
-
For those who read this post:
Since my original post I found the wait(time) command is a MySensors macro that essentially is a "wait millis()" function.
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
PJON and Minicore not working
Development • 21 days ago • Trand 21 days ago -
Gateway without a radio
Development • 12 Jan 2025, 23:19 • OldSurferDude 14 Jan 2025, 22:07 -
MQTT-Help me understand about the MQTT Gateway.
Development • 2 Mar 2025, 01:44 • dpcons 12 Mar 2025, 23:39 -
Saving last known good state, but not in EEPROM
Development • 30 Jan 2024, 18:46 • OldSurferDude 15 Jan 2025, 08:51