Programming a Limit Switch

Hello this is Elijah from Team 1831, I am the new programming lead for our team and I’m having trouble finding out how to program a limit switch to stop a motor when it’s pressed. This is because we recently switch to Java Command-Based. Any help would be great as I’ve been searching Chief Delphi for a while and can’t really find what I’m looking for.

Thank You

Hi,

Here is the wpi page on how to create and talk to limit switches

Here is the example command page on how to bind a DIO as a “trigger”

Also, depending on what motor controllers you are using, sometimes you can directly tie the limit switch into the motor controller to act as a hard stop, without any code. What motor/controller are you using?

-Will