Guest User

Untitled

a guest
Nov 20th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. package org.usfirst.frc.team1251;
  2.  
  3. import edu.wpi.first.wpilibj.IterativeRobot;
  4. import edu.wpi.first.wpilibj.Joystick;
  5. import edu.wpi.first.wpilibj.RobotDrive;
  6. import edu.wpi.first.wpilibj.Talon;
  7.  
  8. /**
  9. * Created by Eric Engelhart on 11/18/2017.
  10. */
  11. public class Robot extends IterativeRobot {
  12. // front left, back left, front right, back right
  13. Talon FL;
  14. Talon BL;
  15. Talon FR;
  16. Talon BR;
  17.  
  18. RobotDrive drivetrain;
  19.  
  20. Joystick controller;
  21.  
  22. @Override
  23. public void robotInit() {
  24. // assuming that the pwm ports are connected to speed controllers as follows:
  25. // front left: 0, front right: 1, back left: 2, back right: 3
  26. FL = new Talon(0);
  27. BL = new Talon(2);
  28.  
  29. FR = new Talon(1);
  30. BR = new Talon(3);
  31.  
  32. drivetrain = new RobotDrive(FL, BL, FR, BR);
  33. // controller plugged into the usb port 0
  34. controller = new Joystick(0);
  35. }
  36.  
  37. @Override
  38. public void autonomousInit() {
  39.  
  40. }
  41.  
  42. @Override
  43. public void autonomousPeriodic() {
  44.  
  45. }
  46.  
  47. @Override
  48. public void teleopInit() {
  49.  
  50. }
  51.  
  52. @Override
  53. public void teleopPeriodic() {
  54. // assuming the left drive input is the 0th axis, and the right drive input is the 1st axis
  55. drivetrain.tankDrive(controller.getRawAxis(0), controller.getRawAxis(1));
  56. }
  57.  
  58. }
Add Comment
Please, Sign In to add comment