Hi BPtigers,
Sorry for the confusion
The wiring of DIO isn't as straight forward you would assume so let me try and clarify.
If you open the Help>>Find Examples and find the FRC Robotics folder in the NI Example Finder you will see a Digital folder that contains example VIs.
Open the Simple Digital Input.lvproj
![example finder.png](http://forums.ni.com/legacyfs/online/37350_example finder.png)
When you Open the Simple digital Input.vi from the project and look at the front panel the diagram to the right explains how the digital input needs to be connected.
![example finder 3.png](http://forums.ni.com/legacyfs/online/37351_example finder 3.png)
Electrically the Limit switch needs to be connected from SIG to [-]
The input will be in a high state by default until it is connected to [-]
So the code I showed before would only work if you wired a normally closed limit switch from SIG to [-]
and the switch would open at the limit position.
This wiring setup although not exactly straight forward is actually the best way to setup a limit switch. The reason why it is a good solution is that it forces the limit switch to be connected in order for the motor to run. If the limit switch gets unplugged or a wire gets cut it turns on the input indicating a limit condition.
As well as stopping the motor from moving when the limit switch is pressed it will also stop if the limit switch is not connected.
So if possible I would recommend connecting the limit switch Normally closed to [-] and Common to SIG.
If your limit switch does not have NC terminal then you will have to modify the code slightly to make it work.
Use a "not" function coming out of the Get Digital input vi to invert the boolean as shown
![example Hi lo 1.png](http://forums.ni.com/legacyfs/online/37353_example Hi lo 1.png)