View Single Post
  #4   Spotlight this post!  
Unread 12-11-2014, 23:09
WilliamR WilliamR is offline
Registered User
FRC #3331
 
Join Date: Nov 2014
Location: Chapel Hill, NC
Posts: 3
WilliamR is an unknown quantity at this point
Re: Sequences of Commands

Quote:
Originally Posted by JamieKilburn View Post
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);
}
Reply With Quote