Skip to content

Instantly share code, notes, and snippets.

@MC42

MC42/Robot.java Secret

Last active January 15, 2019 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MC42/233885268f0d8e480dd920ed7dcdf3db to your computer and use it in GitHub Desktop.
Save MC42/233885268f0d8e480dd920ed7dcdf3db to your computer and use it in GitHub Desktop.
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
public class Robot extends TimedRobot {
private CANSparkMax zero, one , two , three;
private XboxController xboi;
private DifferentialDrive driveyBoi;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
@Override
public void robotInit() {
zero = new CANSparkMax(1, MotorType.kBrushless);
one = new CANSparkMax(2, MotorType.kBrushless);
two = new CANSparkMax(3, MotorType.kBrushless);
three = new CANSparkMax(4, MotorType.kBrushless);
xboi = new XboxController(1);
two.follow(zero);
three.follow(one);
three.setInverted(true);
two.setInverted(true);
driveyBoi = new DifferentialDrive(zero, one);
}
/**
* This function is called every robot packet, no matter the mode. Use
* this for items like diagnostics that you want ran during disabled,
* autonomous, teleoperated and test.
*
* <p>This runs after the mode specific periodic functions, but before
* LiveWindow and SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
}
/**
* This autonomous (along with the chooser code above) shows how to select
* between different autonomous modes using the dashboard. The sendable
* chooser code works with the Java SmartDashboard. If you prefer the
* LabVIEW Dashboard, remove all of the chooser code and uncomment the
* getString line to get the auto name from the text box below the Gyro
*
* <p>You can add additional auto modes by adding additional comparisons to
* the switch structure below with additional strings. If using the
* SendableChooser make sure to add them to the chooser code above as well.
*/
@Override
public void autonomousInit() {
}
/**
* This function is called periodically during autonomous.
*/
@Override
public void autonomousPeriodic() {
}
/**
* This function is called periodically during operator control.
*/
@Override
public void teleopPeriodic() {
driveyBoi.arcadeDrive(xboi.getRawAxis(1), xboi.getRawAxis(0));
}
/**
* This function is called periodically during test mode.
*/
@Override
public void testPeriodic() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment