Calculation of time interval
-
I am trying to calculate time interval by calling millis() function in loop().
Looks like returned values are affected by smartSleep(). I mean time doesn't grow much during sleep.
Is there a more reliable way to detect timeout?@benya the 'sleep' function causes the millis() timer to stop. Using an external clock (rtc) would be the best solution for low power operation. If you know how long you sleep you can do some calculations in the loop. Smartsleep() is not very predictable in this case ;)
-
@benya the 'sleep' function causes the millis() timer to stop. Using an external clock (rtc) would be the best solution for low power operation. If you know how long you sleep you can do some calculations in the loop. Smartsleep() is not very predictable in this case ;)
-
@benya That would be a solution just be aware that you need to wail for reception of the time information.
@AWI If node requests time and values before going to sleep, it will receive them upon return from smartSleep?
void loop() { requestTime(); request(1, V_STATUS); request(2, V_STATUS); smartSleep(200); } void receive(const MyMessage &message) { ... } void receiveTime(unsigned long ts) { ... }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login