I have tried almost everything to fix this. I need some help.
Below is my OI code, and below that is my ArmClose code. My ArmOpen code is almost exactly the same as that, but the ArmClose code does not work.
package org.usfirst.frc3680.RecycleRush;
import org.usfirst.frc3680.RecycleRush.commands.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.buttons.*;
/**
* This class is the glue that binds the controls on the physical operator
* interface to the commands and command groups that allow control of the robot.
*/
public class OI {
//// CREATING BUTTONS
// One type of button is a joystick button which is any button on a joystick.
// You create one by telling it which joystick it's on and which button
// number it is.
// Joystick stick = new Joystick(port);
// Button button = new JoystickButton(stick, buttonNumber);
// There are a few additional built in buttons you can use. Additionally,
// by subclassing Button you can create custom triggers and bind those to
// commands the same as any other Button.
//// TRIGGERING COMMANDS WITH BUTTONS
// Once you have a button, it's trivial to bind it to a button in one of
// three ways:
// Start the command when the button is pressed and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenPressed(new ExampleCommand());
// Run the command while the button is being held down and interrupt it once
// the button is released.
// button.whileHeld(new ExampleCommand());
// Start the command when the button is released and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenReleased(new ExampleCommand());
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
public JoystickButton button10;
public JoystickButton button11;
public JoystickButton button6;
public JoystickButton button7;
public Joystick joystick1;
public Joystick joystick2;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
public OI() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
joystick2 = new Joystick(1);
joystick1 = new Joystick(0);
button6 = new JoystickButton(joystick1, 6);
button6.whenPressed(new ArmOpen());
button7 = new JoystickButton(joystick1, 7);
button7.whenPressed(new ArmClose());
button11 = new JoystickButton(joystick1, 11);
button11.whenPressed(new ArmUp());
button10 = new JoystickButton(joystick1, 10);
button10.whenPressed(new ArmDown());
// SmartDashboard Buttons
SmartDashboard.putData("ArmUp", new ArmUp());
SmartDashboard.putData("ArmDown", new ArmDown());
SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
SmartDashboard.putData("ArmOpen", new ArmOpen());
SmartDashboard.putData("ArmClose", new ArmClose());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=FUNCTIONS
public Joystick getJoystick1() {
return joystick1;
}
public Joystick getJoystick2() {
return joystick2;
}
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=FUNCTIONS
}
package org.usfirst.frc3680.RecycleRush.commands;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc3680.RecycleRush.Robot;
import org.usfirst.frc3680.RecycleRush.RobotMap;
import edu.wpi.first.wpilibj.*;
/**
*
*/
public class ArmClose extends Command {
public ArmClose() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
requires(Robot.armOpenClose);
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
}
// Called just before this Command runs the first time
protected void initialize() {
Robot.armOpenClose.initializeCounter();
Robot.armOpenClose.armClose();
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return Robot.armOpenClose.isSwitch1Set();
}
// Called once after isFinished returns true
protected void end() {
Robot.armOpenClose.armStop();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}
Help?