added switch logic
This commit is contained in:
parent
f33f35b8f8
commit
4906c7f0fb
@ -6,6 +6,7 @@ package frc.robot;
|
||||
|
||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
||||
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandPS5Controller;
|
||||
@ -15,18 +16,21 @@ import frc.robot.constants.IOConstants;
|
||||
import frc.robot.subsystems.Arm;
|
||||
import frc.robot.subsystems.DriveTrain;
|
||||
import frc.robot.subsystems.Grabber;
|
||||
import frc.robot.subsystems.HighFive;
|
||||
|
||||
public class RobotContainer {
|
||||
private CommandPS5Controller driver;
|
||||
private Arm arm;
|
||||
private DriveTrain driveTrain;
|
||||
private Grabber grabber;
|
||||
private HighFive highFive;
|
||||
|
||||
public RobotContainer() {
|
||||
arm = new Arm();
|
||||
driveTrain = new DriveTrain();
|
||||
grabber = new Grabber();
|
||||
driver = new CommandPS5Controller(IOConstants.kDriverID0);
|
||||
highFive = new HighFive();
|
||||
configureBindings();
|
||||
}
|
||||
|
||||
@ -49,8 +53,12 @@ public class RobotContainer {
|
||||
driver.povUp().whileTrue(arm.runArmMotor(1));
|
||||
|
||||
driver.povDown().whileTrue(arm.runArmMotor(-1));
|
||||
|
||||
Shuffleboard.getTab("HighFive")
|
||||
.addBoolean("Switch Pressed", () -> highFive.SwitchDigitalInput());
|
||||
}
|
||||
|
||||
|
||||
public Command getAutonomousCommand() {
|
||||
return Commands.print("No autonomous command configured");
|
||||
}
|
||||
|
16
src/main/java/frc/robot/subsystems/HighFive.java
Normal file
16
src/main/java/frc/robot/subsystems/HighFive.java
Normal file
@ -0,0 +1,16 @@
|
||||
package frc.robot.subsystems;
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class HighFive extends SubsystemBase {
|
||||
private DigitalInput switchDigitalInput;
|
||||
|
||||
public HighFive(){
|
||||
switchDigitalInput = new DigitalInput(0);
|
||||
}
|
||||
|
||||
public boolean SwitchDigitalInput() {
|
||||
return switchDigitalInput.get();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user