Thread: Java Help
View Single Post
  #10   Spotlight this post!  
Unread 10-01-2012, 20:12
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: Java Help

Ok, so I wrote a simpler version of your code to reduce redundancy.
Only problem you had was that u stored your left and right values before the loop. so once it had a value, that loop would continuously give the motors that value.

Code:
public void operatorControl() {
     stick1 = new Joystick(1);
     tank = new RobotDrive(2,1);//Left, Right. PWM values instead of passing jaguars
     tank.setExpiration(0.1);//Not sure if you need this. Probably not.     
        while (true && isOperatorControl() && isEnabled())
        {
          tank.tankDrive(stick1.getRawAxis(1),stick1.getRawAxis(3));
           Timer.delay(0.005);//Probably don't need this either
        }
    }
__________________
Reply With Quote