LabVIEW Switches

Hey guys, I know how to do this in C++ but I have no clue how to in LabVIEW.

Attached to my driver station I have a switch with 3 possible values. I want to use this switch to control a motor speed, as 3 different values.

Orientation 1 = Off
Orientation 2 = .5
Orientation 3 = 1

However I don’t know how to communicate this in my code… my team has this particular switch plugged into input 2 on the driver station, the victor for the motor I want to control is plugged into slot 1 on the first digital sidecar. Any help when it comes to this would be much appreciated.

Also, I can’t really figure out much in LabVIEW and all my code seems really messy. I understand LabVIEW in general, but I can’t seem to master the FRC components of it. If anyone has a link to (or better yet, has written) a tutorial on the topic, please let me know, some aspects of this are driving me insane.


Its not obvious whether you are using 1 driver station analog or mutliple digital inputs.
For digital inputs you need the vi Drvr Stn/Get Dig In, this gives you an array of bools, one for each digital input, just use the array vis to access the particular input value you want.
For analog, you need the vi Drvr Stn/Get Alg In, this gives 4 outputs, 1 number for each analog input. If I remember correctly the value is 0-5 float. Just get the inputs you need an convert the range.
I dont have a tutorial but I have an example of each (read 2 digital inputs into a global array and control 2 servos from 2 analog inputs) if this doesn’t get you going.

If you want to see working code, you might try the FRC examples. If you want a tutorial, you might want to try the LVMastery tip jar ones from Ben Zimmer.

There are also some good ones on

Greg McKaskle

Thanks for the help guys, I have a couple codes written and I’ll try building them on the spare cRIO this week. Thanks again for helping so quickly!