Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Wait() or delay()

Wait() or delay()

Scheduled Pinned Locked Moved Development
5 Posts 3 Posters 5.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lafleur
    wrote on last edited by
    #1

    I take it, its better to use the wait(xx) function in my sensor program over the delay(xx);??

    L 1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      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

      1 Reply Last reply
      0
      • L lafleur

        I take it, its better to use the wait(xx) function in my sensor program over the delay(xx);??

        L Offline
        L Offline
        lafleur
        wrote on last edited by
        #3

        @lafleur

        in 2.0.0b

        process(); will give undefined errors,
        _process(); works...

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lafleur
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by hek
            #5

            Yes, still found in a couple of examples. Should be removed (unless they are used because no messages should be processed).

            https://github.com/mysensors/Arduino/search?utf8=✓&q=delay++path%3A%2Flibraries%2FMySensors%2Fexamples%2F&type=Code

            In 2.0 you shouldn't need to call process yourself. It is handled by the library.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            12

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular