# Switching DigitalOutputs in Timeloop

**URL:** <https://discourse.nodered.org/t/switching-digitaloutputs-in-timeloop/81294>\
**Category:** General\
**Created:** [14 September 2023 05:34 UTC](https://discourse.nodered.org/t/switching-digitaloutputs-in-timeloop/81294 "2023-09-14T05:34:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gumue](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gumue](https://discourse.nodered.org/u/gumue)\
**Post date:** [14 September 2023 05:34 UTC](https://discourse.nodered.org/t/switching-digitaloutputs-in-timeloop/81294/1 "2023-09-14T05:34:41Z")

</div>

Hello dear Comunity,

I have another problem with a timeloop. I have 6 switching outputs that should be switched in a loop with adjustable time on and pause in a loop. The logic is as follows:  
Via UI setting switching time (t\_on) on for outputs (DO) and pause(t\_break) and start/stop.  
After start  
DO1 TRUE while t\_on, all DO FALSE while t\_break  
DO2 TRUE while t\_on, all DO FALSE while t\_break  
...  
DO6 TRUE while t\_on, all DO FALSE while t\_break  
DO1 TRUE while t\_on, all DO FALSE while t\_break  
....  
I don't have a clever solution yet to implement this in Node-Red - thank you!

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [14 September 2023 07:33 UTC](https://discourse.nodered.org/t/switching-digitaloutputs-in-timeloop/81294/2 "2023-09-14T07:33:31Z")

</div>

Have you thought about using the msg.delay option within the 'delay' node?

 ![variable_delay](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bc9dbbc37a2dfe606e4e2756aca5445231e21c3d.png)  
Please note the value you pass-in is the number of **milliseconds** for the delay.  
So 5000 would represent a delay of 5-secs.

Note:  
I've used this method in some of my Finite State Machines (FSMs) where I needed a transition from one state to another that had a variable time delay.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 November 2023 07:34 UTC](https://discourse.nodered.org/t/switching-digitaloutputs-in-timeloop/81294/3 "2023-11-13T07:34:13Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
