Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions Robot-2020/src/main/java/frc/subsystems/Elevator.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@

import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.can.VictorSPX;
import com.revrobotics.CANDigitalInput.LimitSwitch;

import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.utils.Constants;
import edu.wpi.first.wpilibj.Counter;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Ultrasonic;

public class Elevator extends SubsystemBase {
private VictorSPX motorcontroller;
private Ultrasonic ultra;
DigitalInput limitSwitch = new DigitalInput(Constants.DIO_ELEVATOR);
Counter counter = new Counter(limitSwitch);

public Elevator() {
motorcontroller = new VictorSPX(Constants.CAN_ELEVATOR); //TODO: Find a CAN ID for the Elevator
motorcontroller = new VictorSPX(Constants.CAN_ELEVATOR);
motorcontroller.configOpenloopRamp(0);
ultra = new Ultrasonic(7, 6);
ultra.setAutomaticMode(true);
Expand All @@ -39,7 +34,6 @@ public boolean isBallIn(){
if (ultra.getRangeInches() < 3) {
return true;
}

return false;
}

Expand All @@ -52,19 +46,15 @@ public void startMotorGated() {
motorcontroller.set(ControlMode.PercentOutput, 0.0);
return;
}

motorcontroller.set(ControlMode.PercentOutput, 0.2);
// System.out.print("ELEVATOR ACTIVE");
}

public void stopMotor() {
motorcontroller.set(ControlMode.PercentOutput, 0);
// System.out.print("ELEVATOR OFF");
}

@Override
public void periodic() {
// This method will be called once per scheduler run
// System.out.println(ultra.getRangeInches());
}
}
1 change: 0 additions & 1 deletion Robot-2020/src/main/java/frc/utils/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class Constants {
public static final int DIO_CLIMB_ENC_CHN_A = 0;
public static final int DIO_CLIMB_ENC_CHN_B = 1;
public static final int DIO_CLIMB_LIMIT = 3;
public static final int DIO_ELEVATOR = 4;


}