Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.usfirst.frc.team2834.robot;
- import edu.wpi.first.wpilibj.Compressor;
- import edu.wpi.first.wpilibj.IterativeRobot;
- import edu.wpi.first.wpilibj.Joystick;
- import edu.wpi.first.wpilibj.RobotDrive;
- import edu.wpi.first.wpilibj.RobotDrive.MotorType;
- import edu.wpi.first.wpilibj.Solenoid;
- import edu.wpi.first.wpilibj.Victor;
- /**
- * 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 {
- Joystick gamepad = new Joystick(0);
- RobotDrive motors = new RobotDrive(0,1,2,3);
- //Victor cannonLift = new Victor(4);
- Compressor c = new Compressor(0);
- Compressor d = new Compressor(1);
- Solenoid shoot = new Solenoid(1);
- Solenoid lift1 = new Solenoid(2);
- /**
- * This function is run when the robot is first started up and should be
- * used for any initialization code.
- */
- public void robotInit() {
- //----------------Changes below this line-------------------------------
- //If the robot ends up backwards switch the next two lines for the two below them
- motors.setInvertedMotor(MotorType.kFrontLeft, true);
- motors.setInvertedMotor(MotorType.kRearLeft, true);
- motors.setInvertedMotor(MotorType.kFrontRight, true);
- motors.setInvertedMotor(MotorType.kRearRight, true);
- //----------------Changes above this line-------------------------------
- c.start();
- d.start();
- }
- /**
- * This function is called periodically during autonomous
- */
- public void autonomousPeriodic() {
- }
- /**
- * This function is called periodically during operator control
- */
- public void teleopPeriodic() {
- // Sebastian originally told us the cannon would be lifted with motors...
- /*motors.arcadeDrive(gamepad.getRawAxis(1), gamepad.getRawAxis(4));
- // 'y' button
- if (gamepad.getRawButton(4)){
- cannonLift.set(0.5);
- }
- // 'a' button
- else if (gamepad.getRawButton(1)){
- cannonLift.set(-0.5);
- }
- else{
- cannonLift.set(0);
- }*/
- motors.arcadeDrive(gamepad.getRawAxis(1), gamepad.getRawAxis(4));
- // 'y' button; lift cannon
- if (gamepad.getRawButton(4)){
- lift1.set(true);
- shoot.set(false);
- }
- // 'a' button; shoot cannon
- else if (gamepad.getRawButton(1)){
- lift1.set(false);
- shoot.set(true);
- }
- // do nothing?
- else{
- lift2.set(false);
- lift1.set(false);
- shoot.set(false);
- }
- }
- /**
- * This function is called periodically during test mode
- */
- public void testPeriodic() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement