11-29-2019 06:37 AM
Hi together,
I'm trying to fit these two while loops into the programm(see attached vi) now ive got the problem that i need to stop the inner loop to change the input value. Can someone tell me which other ways there are to get where i want to get?
11-29-2019 06:44 AM - edited 11-29-2019 06:46 AM
11-29-2019 06:45 AM
Thank you very much! Gonna try it!
11-29-2019 06:56 AM
I cant use the "select" mode, if i want to add more buttons for different values, right?
11-29-2019 07:07 AM
Hi WZL,
@WZL_94 wrote:
I cant use the "select" mode, if i want to add more buttons for different values, right?
Well, you could use more than one Select node…
To keep the code clean and scalable there are other methods:
11-29-2019 07:43 AM
Another thing you could do to select one of a (small) finite set is to use an "enum" (short for "Enumerated Something-or-other"). For example, suppose you wanted to select a Color from the list "Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet". On the Front Panel, you could "drop" an Enum (from "Ring and Enum" Palette), call it "Color", right-click and edit it and assign it those seven "human-understandable" values (i.e. "Red", etc.). When you are done, you'll see that you have a Control that can take on those seven (and only those seven) values. Behind the scenes, LabVIEW represents them as U16 (I think, but it doesn't matter), but in dealing with you, they are color names.
Guess what happens if you put Color in a Value-changed Event, and you change the color? The Event fires, and you get the current color. What if you take Color and increment it? If it was Green, you get Blue. If it was Violet, you get the "next" color, which is "Red". This makes it easy to write a While loop to "loop" through the colors one at a time, like this:
Color Enum to Array of Color
This takes the Color Enum (which has who-knows-how-many-values) and enumerates them one at a time, outputting the values into a Color Array. We use the first color presented (which might not be the first color of the Enum, i.e. it might be "Green", not "Red") and keep looping until the "next" color matches the first, which means we are done.
I attached a LabVIEW 2017 version.
Bob Schor