To realize a simple delay, use the timer element. The duration can be determined as a constant (at design-time) via the context menu, where also the current value is shown.
To change the duration at run-time, you can connect an object flow to a timer that provides an integer (int). The value will be used to set the duration of the timer in milliseconds. If a timer is activated again before it expired, the timer is restarted, which means that the time period begins again.
A timer with 0 ms duration is used when an activity step needs to be split into two, but without any delay. This can happen for instance to comply with the contract of a block. To obtain this type of timer, add a timer component and from its context menu, set the duration to 0 ms. Currently, this kind of timer looks like the following figure.
In many cases, you may need more control over the timer, for instance, turn it off again. For these cases exist dedicated building blocks in the standard library, from which we introduce some blocks below.
In some cases, you want the possibility to stop a timer. For this case, SDK provided two building blocks in the Timers Library (com.bitreactive.library.timers), i.e., Timer and Timer 2. Both realize timers that can be aborted via a pin. The only difference is that the duration for Timer is determined by an instance parameter and Timer 2 accepts a duration at run-time.
Periodic Timers can be realized easiest by the special building block Timer Periodic. This block comes in two variants. The first takes the duration as an instance parameter. The second variant accepts the duration of the period as input parameter.
To observe if a certain event happens within a certain time, i.e., an event arrives in time, use the Timeout block or its variants from the library.