09-14-2012 04:48 PM - edited 09-14-2012 04:51 PM
Hi I'm learning about the use of parallel whiles for my program. Just can someone explain me why in the attached example, the delayed leds do not behave as they should. For example, if LED 1 has 500ms delay and LED 2 1000ms delay, LED 2 turns off first. But if LED 1 delay is higher than LED 2 delay, it works properly.
If I use single stepping it works properly.
09-14-2012 05:12 PM
You have a race condition, because the upper loop will run a second time most of the time (after turning off the LED for a nanosecond) because the lower loop takes twice as long before resetting the switch. If you increase the upper delay to e.g. 600ms, your VI will work more reliably.
What is the purpose of the outer while loop?
09-14-2012 05:16 PM
I probably would use event structures for this, see attached simple example (LV 2010).