View Single Post
  #1   Spotlight this post!  
Unread 06-02-2012, 17:11
nuru nuru is offline
Registered User
FRC #4404
 
Join Date: Jan 2012
Location: missouri
Posts: 4
nuru is an unknown quantity at this point
help for code to run motor

We are a rookie team and we wrote the following code to operate the motor.
We are not sure if it will work. Please help.

public class ParkwayRobot extends SimpleRobot
{
private final int PORT_ONE = 1;
private final int PORT_TWO = 2;
private final int MY_SLOT = 1; // or 2, 3, 4
private final double DESIRED_SPEED = 0.7;

RobotDrive drive = new RobotDrive(1, 2); // motors in ports 1 and 2
Joystick leftJoy = new Joystick(PORT_ONE);
Joystick rightJoy = new Joystick(PORT_TWO);

public void autonomous()
{

Jaguar firstJaguar = new Jaguar(MY_SLOT, PORT_ONE);
firstJaguar.set(DESIRED_SPEED); // between -1.0 and 1.0
}

public void operatorControl()
{

while (isOperatorControl() && isEnabled())
{
Drive.tankDrive(leftJoy, rightJoy);
Timer.delay(0.005);
}
}

}

We are not sure how to compile and run this code using Netbeans. Please help.

Thanks a lot!
Reply With Quote