How to configure limit switches on a TalonSRX

Hi, I’m trying to configure a hardware limit switch using the configForwardLimitSwitchSource(); and configReverseLimitSwitchSource(); on a TalonSRX motor controller. What parameters should I put into these methods since the ones I got from Phoenix Tuner didn’t work?

Hello, if you are trying to run a command depending on the limit switch’s status, you can also connect the limit switch to the roboRIO and read the value from limit switch as an input then you can run the command with a simple if-else statement.

1 Like

I believe those methods tell the TalonSRX where the Limit switches are connected and needed if you plan NOT to wire them to the Data Port of the TalonSRX but to a remote TalonSRX or CANifier.

What are your intentions?
Do you wish to switch them from normally open to normally closed?
Use a switch to zero an encoder? _talon.configClearPositionOnLimitR(true, Constants.kTimeoutMs);
Monitor the switch in your Code? _talon.getSensorCollection().isFwdLimitSwitchClosed(); _talon.getSensorCollection().isRevLimitSwitchClosed();

This doesn’t yet answer your question but points out that the method you asked about has many Overloads and parameter input patterns and possibilities here are the Java Docs:

The Phoenix Documentation on Github includes examples for remote and non remote limit switches.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.