So my team may or may not use a switch to stop our winch.
I think it would use Digital Input/Digital Output vis, but I don’t know.
Help please?
That depends on where the switch is (on robot or on the Driver Station).
A limit switch on the robot that stops the winch would connect to a Digital Input.
How would the left one work?
The left one just checks to see IF the driver joystick is ordering forward motion AND the limit switch in that direction is being depressed, THEN make the power to the motor =0.
If the motor is moving away from the limit switch or the limit switch hasn’t been hit, then it’s safe to let the motor do what the driver ordered.
The switch would need to make a motor stop and then a pneumatic to extend when it is pressed. Would I just remove the joystick and axis bits from that code?
You can remove the Joystick as long as you have something telling the motor to move and how fast. It could be triggered in a sequence, for instance.
As far as triggering pneumatics when the switch gets depressed, you could set that up as a completely separate action – If limit switch, then set solenoid.
But it all depends on how you want to reverse or reset these actions.
It sounds like you might want this to be a sequence of steps in Periodic Tasks.
Periodic is exactly where I was going to put it. What vi would a limit switch be?
Limit switches are Digital Inputs.
WPI Robotics Library -> IO -> DigitalInput
Get returns a true or false.