View Single Post
  #2   Spotlight this post!  
Unread 29-01-2012, 01:09
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: Programming with CAN Jaguars

id be happy to


Code:
CANJaguar motor1, motor2, motor3, motor4;
RobotDrive myrobot;
Joystick left, right;
public void robotInit() {

try {
            motor1 = new CANJaguar(1); // ID number of jaguar
            motor2 = new CANJaguar(2);
            motor3 = new CANJaguar(3);
            motor4 = new CANJaguar(4);

        } catch (CANTimeoutException ex) {
            ex.printStackTrace();
        }

myrobot = new RobotDrive(motor1,motor2,motor3,motor4);

left = new JoyStick(1);
right = new JoyStick(2);
}

public void autonomous() {
}

public void operatorControl() {
while(isOperatorControl()) {

myrobot.tankDrive(left.getY(), right.getY());
}
P.S you need the try catch incase it cant find the jaguar id it throws an error
Reply With Quote