Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package org.usfirst.frc.team295.robot;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
public class Robot extends IterativeRobot {
RobotDrive myRobot; // class that handles basic drive operations
Joystick driver; // set to ID 1 in DriverStation
Talon driveBackLeft;
Talon driveBackRight;
Talon driveFrontLeft;
Talon driveFrontRight;
JoystickButton high;
JoystickButton low;
DoubleSolenoid shifter;
public static final DoubleSolenoid.Value GearHigh = DoubleSolenoid.Value.kReverse;
public static final DoubleSolenoid.Value GearLow = DoubleSolenoid.Value.kForward;
public Robot() {
driver = new Joystick(0);
driveBackLeft = new Talon(2);
driveFrontLeft = new Talon(1);
driveBackRight = new Talon(4);
driveFrontRight = new Talon(3);
Compressor c = new Compressor(0);
high = new JoystickButton(driver,2);
low = new JoystickButton(driver,1);
shifter = new DoubleSolenoid(0, 1);
myRobot = new RobotDrive(driveFrontLeft,driveBackLeft,driveFrontRight,driveBackRight);
* Runs the motors with tank steering.
public void teleopPeriodic() {
// driveBackRight.set(1);
// driveFrontRight.set(1);
// driveBackLeft.set(1);
// driveFrontLeft.set(1);
while (isOperatorControl() && isEnabled()) {
myRobot.tankDrive(driver.getRawAxis(1), driver.getRawAxis(5));
Timer.delay(0.005); // wait for a motor update time
public void disabled(){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment