View Single Post
  #4   Spotlight this post!  
Unread 08-03-2012, 17:53
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Need Serious help !!!!

Quote:
Originally Posted by Team1605 View Post
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.
Reply With Quote