Showing results for 
Search instead for 
Did you mean: 

Problem: For-loop and cluster constants


Hi everyone,

ofcourse I didnt suceed to finish my project.
I tried to make a feature that is going to repeat (cycle) the measurment process.
I did it with a for-loop and it worked, but the problem is, that "Time at the beginning" of program is going to be initialised after the 1st loop pass. How to make this make this value constant?

Thanks in advance!

0 Kudos
Message 1 of 2

Put a shift register on the outer For Loop, and pass the value into that.  Make sure it only puts a new value on that outer shift register the first time the outer For Loop runs.


But really, your code is inside out.  It is very odd to have a while loop running inside a For Loop.  Reverse that.  With a state machine, when it comes time to do the 2nd test just have the state machine return it back to the first state.  Keep doing that until your count of how many tests you want to do has been met.


I notice inside the "Repeat Selection" case, you have a lot of redundant code with case structures inside of case structures.  Basically 12 x 9 = 108 individual cases that all do essentially one of two things:  pass along a number, and pass along "adding values to cluster" or "step counter".  You can have two cases, one defined for "/" and the other defined 1..8 for the inner case structure.  For the outer case structure, you can get rid of that and just build your 12 control values into an array and use index array based on the "steps" value to break out the value of the control you want.

0 Kudos
Message 2 of 2