39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
package frc.robot.subsystems.bras;
|
|
|
|
import edu.wpi.first.wpilibj.DigitalInput;
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
import frc.robot.Constants;
|
|
|
|
import com.revrobotics.CANSparkMax;
|
|
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
|
|
|
public class Pivot extends SubsystemBase {
|
|
// moteur
|
|
private CANSparkMax pivot = new CANSparkMax(Constants.pivot,MotorType.kBrushless);
|
|
private DigitalInput limitpivot = new DigitalInput(Constants.limitpivot);
|
|
|
|
// function
|
|
public void monteDescendre(double vitesse) {
|
|
pivot.set (vitesse);
|
|
}
|
|
// encoder
|
|
public double distance(){
|
|
return (pivot.getEncoder().getPosition());
|
|
}
|
|
public void Reset(){
|
|
pivot.getEncoder().setPosition(0);
|
|
|
|
}
|
|
public boolean limitpivot(){
|
|
return limitpivot.get();
|
|
}
|
|
@Override
|
|
public void periodic() {
|
|
// This method will be called once per scheduler run
|
|
}
|
|
}
|