Skip to content

Commit

Permalink
made button
Browse files Browse the repository at this point in the history
  • Loading branch information
EnguerranSorin committed Nov 29, 2023
1 parent c11fd72 commit 83ea560
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.Commands.ElevatorCommand;
import frc.robot.Commands.IntakeCommand;
import frc.robot.Commands.StopIntakeMotorCommand;
import frc.robot.Subsystems.ElevatorSubsystem;
import frc.robot.Subsystems.IntakeSubsystem;

/**
Expand All @@ -24,6 +26,7 @@ public class RobotContainer {

private final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();

private final ElevatorSubsystem elevatorSubsystem = new ElevatorSubsystem();
/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
// Configure the button bindings
Expand Down Expand Up @@ -70,5 +73,8 @@ private void configureButtonBindings() {

// stop the motors
driverB.x().onTrue(new StopIntakeMotorCommand(intakeSubsystem));

driverB.y().onTrue(new ElevatorCommand(elevatorSubsystem, 10));
driverB.b().onTrue(new ElevatorCommand(elevatorSubsystem, 5));
}
}
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/Subsystems/ElevatorSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// the WPILib BSD license file in the root directory of this project.

package frc.robot.Subsystems;
import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonFX;

import edu.wpi.first.math.controller.PIDController;
Expand Down Expand Up @@ -48,6 +49,7 @@ public void periodic() {
motorPower = controller.calculate(targetHeight);

leftMotor.set(TalonFXControlMode.PercentOutput, motorPower);
rightMotor.set(TalonFXControlMode.PercentOutput, motorPower);
currentHeight = ticksToInches(-leftMotor.getSelectedSensorPosition());
}

Expand Down

0 comments on commit 83ea560

Please sign in to comment.