Quote:
Originally Posted by Team1605
Thank you and do you have any idea y the robot won't respond ???
|
Yes, because your code runs once, you need it to loop around constantly looking at the updated values of the joysticks like I posted above. Your operatorControl method should look like this (additions in bold):
Code:
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
while(isOperatorControl() && isEnabled())
{
robotDrive.tankDrive(stickDriverLeft.getAxis(AxisT ype.kY), stickDriverRight.getAxis(AxisType.kY));
if(stickDriverRight.getRawButton(TRIGGER_NUMBER)) {
shooter.set(1);
}
else {
shooter.set(0);
}
if(stickDriverRight.getRawButton(GATHER_START_BUTT ON)) {
gatherer.set(1);
}
else if(stickDriverRight.getRawButton(GATHER_STOP_BUTTO N)) {
gatherer.set(0);
}
Timer.delay(.01);
}
}
You will also need to add an import:
import edu.wpi.first.wpilibj.Timer;
That will make your code loop every 10 ms.