Quote:
Originally Posted by JamieKilburn
CommandGroups are definitely what you want here.
|
Here is the code that we are using to test the latching of our winch after a limit switch is activated.
void shoot() {
latchPneumatic.set(DoubleSolenoid.Value.kReverse);
}
void winch(int direction, double unwindTime) {
if (direction == 1) {
while (catapultLimitSwitch.get() == true) {
winchMotor.set(1);
}
//latchPneumatic.set(DoubleSolenoid.Value.kReverse);
winchMotor.set(0);
}
else if (direction == -1) {
for (int i = 0; i < unwindTime*10000; i++) winchMotor.set(-1);
winchMotor.set(0);
}
else winchMotor.set(0);
}