Merge branch 'main' of https://git.demerso.net/pls5618/2024/robot
This commit is contained in:
@ -12,6 +12,7 @@ import edu.wpi.first.networktables.GenericEntry;
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.DoubleSolenoid;
|
||||
import edu.wpi.first.wpilibj.PneumaticsModuleType;
|
||||
import edu.wpi.first.wpilibj.Solenoid;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
@ -34,8 +35,8 @@ public class Grimpeur extends SubsystemBase {
|
||||
// limit switch
|
||||
final DigitalInput limitdroite = new DigitalInput(Constants.limithaut);
|
||||
final DigitalInput limitgauche = new DigitalInput(Constants.limitbas);
|
||||
final DoubleSolenoid pistondroite= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre, Constants.pistondroiteouvre);
|
||||
final DoubleSolenoid pistondgauche= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre, Constants.pistondroiteouvre);
|
||||
final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre);
|
||||
final Solenoid pistondgauche = new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre);
|
||||
//fonction
|
||||
public Grimpeur() {
|
||||
layout.addBoolean("limitgrimpeurd", limitdroite::get);
|
||||
@ -72,15 +73,16 @@ public AHRS gyroscope = new AHRS();
|
||||
public double getpitch(){
|
||||
return gyroscope.getPitch();
|
||||
}
|
||||
public boolean pistonouvre(){
|
||||
pistondroite.set(Value.kForward);
|
||||
pistondgauche.set(Value.kForward);
|
||||
return pistondroite.isFwdSolenoidDisabled();
|
||||
}
|
||||
public void pistonferme(){
|
||||
pistondroite.set(Value.kReverse);
|
||||
pistondgauche.set(Value.kReverse);
|
||||
|
||||
pistondroite.set(true);
|
||||
pistondgauche.set(true);
|
||||
}
|
||||
public void pistonouvre(){
|
||||
pistondgauche.set(false);
|
||||
pistondroite.set(false);
|
||||
}
|
||||
public boolean piston(){
|
||||
return pistondgauche.get();
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
|
@ -12,14 +12,19 @@ public class LED extends SubsystemBase {
|
||||
/** Creates a new LED. */
|
||||
public LED() {}
|
||||
AddressableLED led = new AddressableLED(9);
|
||||
AddressableLEDBuffer ledBuffer = new AddressableLEDBuffer(60);
|
||||
AddressableLEDBuffer ledBuffer = new AddressableLEDBuffer(150);
|
||||
public void led(){
|
||||
led.setData(ledBuffer);
|
||||
led.start();
|
||||
}
|
||||
public void couleur(int R, int G, int B){
|
||||
ledBuffer.setRGB(0, R, G, B);
|
||||
led.start();}
|
||||
|
||||
public void couleur(int R, int G,int B){
|
||||
for (int i = 0; i < ledBuffer.getLength(); i++) {
|
||||
// Sets the specified LED to the RGB values for red
|
||||
ledBuffer.setRGB(i, 255, 0, 0);}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
|
Reference in New Issue
Block a user