Showing results for 
Search instead for 
Did you mean: 

parallel loops seem not dependent on timings

Hi, I have problem with the timings with 2 parallel loops.
I created a pair of loops in parallel, with each having the same workings as another.
They are run side by side. Each loop has 5 Leds to run at iterations with delays.
Except is that red LED on with longer delay.

My objective is that the two loops should be independent from each other and depends on it's own timing and delays.

The problem is that, whichever loop goes into red, then it seems to wait for another loop to finish red , then to end altogether.

Pls see my attached
Pls advise. Thanks. Should I use timed loop?
0 Kudos
Message 1 of 3
According to many posts on this forum, the Wait Until Next ms Multiple is not accurate for the first one or two iterations. The Timed Loop would definitely be better.

Also, even though both loops are in parallel, the Wait function pauses the entire program until its finished.

Robot wink
0 Kudos
Message 2 of 3

The "wait next ms multiple" does NOT wait a specific amount of time, but waits until the ms counter is a multiple of the indicated value.

For example if you specify 500, it can take from 0 to 499ms until the wait completes the first time. If it is in a loop that can complete faster than 500ms, all later waits will complete 500ms after the previous, so the pacing will be exact. However, in your case you add other waits in an inner loop, throwing everything back out of sync.

For a more detailed explanation have a look at my answer in the following related post:

0 Kudos
Message 3 of 3