How to receive time?
-
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!
-
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?
-
@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.
-
Probably I was unclear. time is showing up nicely. But home can I get this variable back to be used in "void loop"?
-
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.
-
@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...
-
@Meister_Petz Sometimes thats the most difficult problem Glad to have helped!