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. How to receive time?

How to receive time?

Scheduled Pinned Locked Moved Development
7 Posts 4 Posters 4.7k Views 1 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.
  • M Offline
    M Offline
    Meister_Petz
    wrote on last edited by
    #1

    Hi,

    how can I get the time from the gateway?

    this is what I call in the loop:

    gw.requestTime(receiveTime);
    

    this is the function:

    void receiveTime(unsigned long time) {
      Serial.println(time);
    }
    

    how do I get "time" out of this function as it is?

    Sorry I'm not a big programmer.

    Thanks for the help!

    J 1 Reply Last reply
    0
    • korttomaK Offline
      korttomaK Offline
      korttoma
      Hero Member
      wrote on last edited by
      #2

      Hi,
      I'm no programmer either but it seems like your variable named time should contain the time from the controller after you cal the requestTime(); function. The question is now what do you want to do with the time? In your example you just print the time to serial. Can you see the received time if you start Serial Monitor?

      • Tomas
      1 Reply Last reply
      0
      • M Meister_Petz

        Hi,

        how can I get the time from the gateway?

        this is what I call in the loop:

        gw.requestTime(receiveTime);
        

        this is the function:

        void receiveTime(unsigned long time) {
          Serial.println(time);
        }
        

        how do I get "time" out of this function as it is?

        Sorry I'm not a big programmer.

        Thanks for the help!

        J Offline
        J Offline
        jkandasa
        Plugin Developer
        wrote on last edited by
        #3

        @Meister_Petz said:

        Hi,

        how can I get the time from the gateway?

        this is what I call in the loop:

        gw.requestTime(receiveTime);
        

        this is the function:

        void receiveTime(unsigned long time) {
          Serial.println(time);
        }
        

        how do I get "time" out of this function as it is?

        Sorry I'm not a big programmer.

        Thanks for the help!

        @Meister_Petz Your controller should support for this query. Gateway forwards this request to controller.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Meister_Petz
          wrote on last edited by
          #4

          Probably I was unclear. time is showing up nicely. But home can I get this variable back to be used in "void loop"?

          1 Reply Last reply
          0
          • L Offline
            L Offline
            LastSamurai
            Hardware Contributor
            wrote on last edited by
            #5

            Define a variable at the start of your program and safe the time in the variable that can then be accessed from the main loop too.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Meister_Petz
              wrote on last edited by
              #6

              @LastSamurai said:

              Define a variable at the start of your program and safe the time in the variable that can then be accessed from the main loop too.

              Many Thanks... obvious now...

              L 1 Reply Last reply
              0
              • M Meister_Petz

                @LastSamurai said:

                Define a variable at the start of your program and safe the time in the variable that can then be accessed from the main loop too.

                Many Thanks... obvious now...

                L Offline
                L Offline
                LastSamurai
                Hardware Contributor
                wrote on last edited by
                #7

                @Meister_Petz Sometimes thats the most difficult problem ;) Glad to have helped!

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


                23

                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