FIRST Robotics Competition Blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Selector Snippet

Whit-E_Wall-E
NI Employee (retired)

We have already looked at Case Structures, but the LabVIEW Select function is another great tool to make programming decisions. A boolean value is connected to the select terminal. If the boolean value is high, the selector returns one value and if the boolean value is low, the selector returns a different value. You can use the selector to choose between values of many different data types such as boolean, strings, or numeric. For example, it is a great tool if you need to press a button to reset a device. If you push the reset button, the selector can choose to write the value to an initialized state. However, if the reset button was not pushed (the boolean value is false), you can choose to continue writing the value that was already there.  This snippet is also using the Feedback Node which we learned in a previous snippet to retain wire values each time the VI runs in the Robot Main.

For more LabVIEW tips and tricks check out this presentation found on the LabVIEW Training Page from ni.com/frc.

NumericSelector.png

Regards,

M. Whitaker
ni.com/support