Limit Switches

Limit switches have many uses on a robot or mechanism.

../../_images/limit-switch-1.svg

Limit Switch Pinout

../../_images/Limit-Switch-Pinout.svg

The inputs on the VMX FlexDIO and Titan are pulled high, with the Titan having hardware debounce correction. When wiring the limit switch it is recommended to wire ground to common and signal to normally open.

Limit Switch Configuration

The limit switch has three ways it can be configured for use.

Default

Forward

No Roller

../../_images/Limit-Switch-Pos-1.svg
../../_images/Limit-Switch-Pos-2.svg
../../_images/Limit-Switch-Pos-3.svg

Programming

Limit Switches are read as a digital input. If wired correctly per the pinout section above, when a switch is activated it will show as low or false.

 1//import the DigitalInput Library
 2import com.wpi.first.wpilibj.DigitalInput;
 3
 4//Create the DigitalInput Object
 5private DigitalInput input;
 6
 7//Constuct a new instance
 8input = new DigitalInput(port);
 9
10//Can then use these accssor to get data
11input.get(); //Will return true for a high signal and false for a low signal