LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for a binary swith

Hi I am new to LabVIEW. I found an example where when a radio button was pushed it puts out an integer instead of T/F. How do I create such a button. I cant find anything under properties for the radio button that does this. thanks

0 Kudos
Message 1 of 8
(2,532 Views)

There are two categories of radio buttons.  One drops by itself and looks like a single circle or square with text next to it.  This is likely what you're using and is true/false only.

 

The other category is radio buttons that look like a box, with 2 circles in it.  That one outputs an integer (an enum, really) and is what you want.

 

The one you want is only in the "Classic" and "Modern" controls, so if you default to using System or Silver, you might not see it.

0 Kudos
Message 2 of 8
(2,529 Views)

@AZ_Cowboy wrote:

Hi I am new to LabVIEW. I found an example where when a radio button was pushed it puts out an integer instead of T/F. How do I create such a button. I cant find anything under properties for the radio button that does this. thanks


You might be confused by the term "radio button". A simple boolean outputs T or F and they are typically called switches or buttons when used as controls.

 

A radiobutton control is a selection of more than one boolean for which only one can be true and pressing a different one makes the current one false (there is also an option to allow no selection if desired). You can place any number and type of booleans in it. The output is basically an enum containing the labels of the boolean controls as items. An enum is not an integer, but you can still use it as one under some conditions, e.g. by wiring it to the index of "index array", etc. You can also do simple math, such as +1 or -1 and it will cycle through the items.

 

So, to get better help, show us what "example" you found (link, example finder, name, etc.). You can even attach the VI here.

0 Kudos
Message 3 of 8
(2,524 Views)

the example I was looking at is call RadioSel.vi. I found it while doing a search in a forum.  What I am doing is trying to mimic a touch pad. btw where is the user library.

0 Kudos
Message 4 of 8
(2,510 Views)

Yes, that's a simple radio-button container as described, containing three buttons. ALso look at my above link. The labels of the buttons are hidden, but they define the items of the enum. The output is NOT an integer!

 

While it is convenient to wire the enum to a case structure for more complicated code paths, the example could be redone as follows in this case if you chose the labels right (... more or less, there is a difference for "no selection").

 

radioaction.png

 

 

The "user library", a defined location in the palettes, is blank by default and intended as a place for your own tools.

 

 

0 Kudos
Message 5 of 8
(2,504 Views)

I think this would get you close to what you are looking for.

Tim
GHSP
0 Kudos
Message 6 of 8
(2,501 Views)

@aeastet wrote:

I think this would get you close to what you are looking for.


That's quite different, because you will have 2^N possible outputs. To have it act as radiobutton (only one selection allowed) would require more code and maybe "search array" to get the index.

 

There are also hard limitations, for example you cannot have more than 64 elements.

0 Kudos
Message 7 of 8
(2,499 Views)

Yes you are right unless you can choose multi inouts. Then you can just read the output and react however you want. It isn't exactly a radio button. Just throwing out some ideas.

Tim
GHSP
0 Kudos
Message 8 of 8
(2,496 Views)