Page 1 of 1

Action "sleep"

Posted: 17 Jun 2018 12:14
by Rafi4
Hi
I am a bit confused about action "sleep". I want to know about action "sleep". In which type of flows I can use this action? Any clarification?
Thanks in advance.

Re: Action "sleep"

Posted: 17 Jun 2018 15:18
by digitalstone
The simplest example is a countdown timer (also stated inside the help section i believe):
In this case of a countdown, you're looping through 10 seconds to 0 seconds let's say...
But you want a second to pass between each second.
In that case you would setup a timer for 1 second.
Now, your phone would normally countdown as fast as the CPU could run through the whole flow, but with the "Sleep" action within it, you're basically saying that it has to wait an entire second between each loop iteration.


Another example would be a "check-counter":
When a flow has been triggered and you want to check-up on afterwards, before you want Automagic to do something else.

You then have to build a continuous cycle of evaluation to check if a certain value has been reached.
like this:
Image

Except... If you would adopt the flow (from the picture) into any digital system, it will strain a LOT of unnecessary calculation from your CPU, because it will run an entire loop EVERY 10ms or so (depending on what you're checking by today's standards).
To make things easier/efficient for your processor, we would like to tell the CPU to sleep until we (we=developers/users/people) decide to check a certain value once again to take a certain action based on that value.

Re: Action "sleep"

Posted: 18 Jun 2018 05:23
by Rafi4
Hi digitalstone
Thanks a lot. Thanks to your quick response and valuable information