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


  • Mod

    @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,
    @mfalkvidd

    No 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


  • Mod

    @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.


Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 2
  • 1
  • 10
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts