11-29-2022 07:06 AM
Use Shift Registers to pass data between iterations of your loop.
12-05-2022 09:12 AM
@crossrulz, you mean to add one while loop around case structure and than add shift registers?
12-05-2022 09:28 AM
Forgive me for "cutting in line", but what @crossrulz means is to add another shift register to the While Loop that surrounds the Case Statement (that combination is "the State Machine"). If you are in State A and in this State, you decide to set some value in the next State, you wire the Value to the "My Value" Shift Register, the next State into the Next State Shift Register, and exit the current state. When you get to the "next State" and need to use the value, its right there on the "My Value" Shift Register.
Note that you might have several different values that you use in your program (let's say, 15 of them). Does this mean you need 15 Shift Registers, one for each Value? You could do that, but the wiring would be (and look) "messy". Instead, make a Cluster that has the 15 Values in it. To add a new Value, do a "Bundle by Name" and put the new Value in to the proper "slot" in the Cluster. To use a value, simply do an Unbundle by Name. [Do you see how useful the "by Name" versions of cluster Bundle and Unbundle can be?]
Bob Schor
12-05-2022 10:18 AM
Thank you for your answer.
And where to put a cluster, outside case structure but inside while loop?
12-06-2022 11:52 AM
Outside of the While Loop. Drag the wire to the While Loop then right-click and select Replace with Shift Register.
Read up on how to use Shift Registers.