LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loop Indexing and Shift Register problem

I am trying to use a FOR loop to do the same thing multiple times. I can painfully write out code over and over and get it to work, but when I try to use a FOR loop, it no longer works. I am having problems using an external shift register in a WHILE loop along with an internal FOR loop correctly.

I have attached a TestCase that does two things:
1) The first set is broken, but shows how I want to multiply-instantiate the same code many times.
2) The second set works correctly, but I had to duplicate code for as many 'lights' as I wanted. This solution is okay for two 'lights', but for my real application, I will have to repeat this 36 times! Clearly by solving my FOR loop problem, the work involved (and difficutly reading by others) will be greatly reduced.

Thanks for you help!
0 Kudos
Message 1 of 3
(2,280 Views)
You need to initialize your shift register with an array of size 2. Currently, it starts as an empty array and since the FOR loop runs as many times as the smallest indexing array input, it will not execute at all. The smallest array is size zero.

(edit: added example)

Message Edited by altenbach on 03-15-2005 12:39 PM

0 Kudos
Message 2 of 3
(2,277 Views)
Wow, that was the fastest solution ever! Thanks!
0 Kudos
Message 3 of 3
(2,272 Views)