After looking around a bit I have learned that I must assign a port for it in RobotMap - I did that.
Then what I can do is create a command to move the motor in one direction and put something like this:
Quote:
|
if limit switch is active(1)
|
in isFinished() so that when the limit switch is pressed the command will finish
Then have a second command that moves the motor in the opposite direction - all the same stuff in the isFinished() except it would be assigned to the second limit switch. When the limit switch is pressed the motor would stop.
I could then put these two commands in a command group like this
Quote:
addSequential(new command);
addSequential(new secondCommand);
|
and the motor would move until it hit the limit switch - stop - and then return to its original position.
I have that all figured out but what I don't get is:
What would I put in a subsystem for the limit switches?
What would I write in the if statement to return true in isFinished when the limit switches state is 1(closed).
Quote:
if (something) {
return true;
}
else {
return false;
}
|
THANKS a ton for the help!