Advertisement
skeggsc

CCRE Example

Oct 14th, 2014
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. import ccre.channel.*;
  2. import ccre.ctrl.*;
  3. import ccre.frc.*;
  4. import ccre.instinct.*;
  5.  
  6. public class Test implements FRCApplication {
  7.     public void setupRobot() {
  8.         FloatInput leftAxis = FRC.joystick1.axis(2);
  9.         FloatInput rightAxis = FRC.joystick1.axis(5);
  10.         FloatOutput leftOut = FRC.talon(2, FRC.MOTOR_FORWARD);
  11.         FloatOutput rightOut = FRC.talon(1, FRC.MOTOR_REVERSE);
  12.  
  13.         Drive.tank(leftAxis, rightAxis, leftOut, rightOut);
  14.  
  15.         BooleanOutput shifter = FRC.solenoid(2);
  16.         shifter.setFalseWhen(FRC.startTele);
  17.         shifter.setTrueWhen(FRC.joystick1.onPress(3));
  18.         shifter.setFalseWhen(FRC.joystick1.onPress(1));
  19.  
  20.         FRC.registerAutonomous(new InstinctModule() {
  21.             @Override
  22.             protected void autonomousMain() throws AutonomousModeOverException, InterruptedException {
  23.                 leftOut.set(-1);
  24.                 rightOut.set(-1);
  25.                 waitForTime(5000);
  26.                 leftOut.set(0);
  27.                 rightOut.set(0);
  28.             }
  29.         });
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement