Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.usfirst.frc.team1251;
- import edu.wpi.first.wpilibj.IterativeRobot;
- import edu.wpi.first.wpilibj.Joystick;
- import edu.wpi.first.wpilibj.RobotDrive;
- import edu.wpi.first.wpilibj.Talon;
- /**
- * Created by Eric Engelhart on 11/18/2017.
- */
- public class Robot extends IterativeRobot {
- // front left, back left, front right, back right
- Talon FL;
- Talon BL;
- Talon FR;
- Talon BR;
- RobotDrive drivetrain;
- Joystick controller;
- @Override
- public void robotInit() {
- // assuming that the pwm ports are connected to speed controllers as follows:
- // front left: 0, front right: 1, back left: 2, back right: 3
- FL = new Talon(0);
- BL = new Talon(2);
- FR = new Talon(1);
- BR = new Talon(3);
- drivetrain = new RobotDrive(FL, BL, FR, BR);
- // controller plugged into the usb port 0
- controller = new Joystick(0);
- }
- @Override
- public void autonomousInit() {
- }
- @Override
- public void autonomousPeriodic() {
- }
- @Override
- public void teleopInit() {
- }
- @Override
- public void teleopPeriodic() {
- // assuming the left drive input is the 0th axis, and the right drive input is the 1st axis
- drivetrain.tankDrive(controller.getRawAxis(0), controller.getRawAxis(1));
- }
- }
Add Comment
Please, Sign In to add comment