Limit Switch Programming

Hi everyone,

For our conveyor system, we added a limit switch for detecting when a ball comes in and to run a motor when the ball touches a limit switch. To run this, I created a command to run a motor for a certain amount of time when the button is pressed. I’m still fairly new to java for FRC (used to use Labview until I switched) and I have never done this before where I want to call upon the command to run when the limit switch is touched.

I’m not completely sure where to put in the code to run the command when the switch is pressed, nor do I even know if this code would work so any help is appreciated.

Thanks!

I’d recommend checking out this recent topic: Digtial Input firing a Command

What I would probably do in this situation is make a default command that sets the motor to run when the limit switch is hit and then sets it to 0 when the limit switch is not hit, and make this the default command for the motor subsystem.

1 Like

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