Quote:
Originally Posted by wildbot3844
Can you post what the code should look like to control a drive with talons?
|
By drive I assume you mean a robot drivetrain? That depends on what language you are using. Here's a quick example in Java:
Code:
import edu.wpi.first.wpilibj.*;
/**
* Simple example of how to use Talons to control a drivetrain
*/
public class TalonExample extends IterativeRobot {
private Joystick joystick = new Joystick(1);
private Talon leftMotor = new Talon(1);
private Talon rightMotor = new Talon(2);
// Pass the RobotDrive constructor the two Talon objects we created
private RobotDrive drive = new RobotDrive(leftMotor, rightMotor);
public void teleopPeriodic() {
drive.arcadeDrive(joystick.getY(), joystick.getX());
}
}