Antoine PerreaultE af2f0bb61b rstdfghjbknl;
2023-03-07 18:01:56 -05:00

45 lines
1.2 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.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
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 {
ShuffleboardTab teb = Shuffleboard.getTab("teb");
// 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);
}
// encodeur
public double distance(){
return (pivot.getEncoder().getPosition());
}
public void Reset(){
pivot.getEncoder().setPosition(0);
}
public boolean limitpivot(){
return limitpivot.get();
}
@Override
public void periodic() {
teb .add("encodeur", 0.1);
}
{
teb.add ("encodeur pivot",0.1);
}
}