2025-01-27 19:11:22 -05:00
|
|
|
// 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;
|
|
|
|
|
2025-02-24 18:18:14 -05:00
|
|
|
import edu.wpi.first.networktables.GenericEntry;
|
2025-01-27 19:11:22 -05:00
|
|
|
import edu.wpi.first.wpilibj.DigitalInput;
|
2025-02-24 18:18:14 -05:00
|
|
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
2025-02-25 16:38:35 -05:00
|
|
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
2025-01-27 19:11:22 -05:00
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
|
|
import com.revrobotics.spark.SparkMax;
|
|
|
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
|
|
|
public class Elevateur extends SubsystemBase {
|
2025-02-25 16:38:35 -05:00
|
|
|
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
2025-01-27 19:11:22 -05:00
|
|
|
/** Creates a new Elevateur. */
|
2025-02-25 16:38:35 -05:00
|
|
|
public Elevateur() {
|
|
|
|
teb.addDouble("encodeur elevateur",this::position);
|
2025-02-25 17:56:24 -05:00
|
|
|
teb.addBoolean("limit elevateur", this::limit2);
|
2025-02-25 16:38:35 -05:00
|
|
|
}
|
2025-02-22 14:46:41 -05:00
|
|
|
final SparkMax monte = new SparkMax(22, MotorType.kBrushless);
|
2025-02-25 17:56:24 -05:00
|
|
|
final DigitalInput limit2 = new DigitalInput(0);
|
2025-02-25 16:38:35 -05:00
|
|
|
|
2025-01-27 19:51:46 -05:00
|
|
|
public double position(){
|
2025-01-27 19:11:22 -05:00
|
|
|
return monte.getEncoder().getPosition();
|
|
|
|
}
|
2025-01-27 19:26:11 -05:00
|
|
|
public void vitesse(double vitesse){
|
2025-01-27 19:15:16 -05:00
|
|
|
monte.set(vitesse);
|
|
|
|
}
|
2025-01-27 19:51:46 -05:00
|
|
|
public boolean limit2(){
|
|
|
|
return limit2.get();
|
|
|
|
}
|
|
|
|
public void reset(){
|
|
|
|
monte.getEncoder().setPosition(0);
|
|
|
|
}
|
2025-01-27 19:11:22 -05:00
|
|
|
@Override
|
|
|
|
public void periodic() {
|
|
|
|
// This method will be called once per scheduler run
|
|
|
|
}
|
|
|
|
}
|