This commit is contained in:
samuel desharnais
2026-03-31 20:29:45 -04:00
parent 7b535a845f
commit 3b06cbd447
2 changed files with 39 additions and 5 deletions

View File

@@ -0,0 +1,39 @@
/* Generated by Phoenix Tuner X */
package frc.robot.subsystems;
import static edu.wpi.first.units.Units.*;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.ctre.phoenix6.CANBus;
import com.ctre.phoenix6.controls.SolidColor;
import com.ctre.phoenix6.hardware.CANdle;
import com.ctre.phoenix6.signals.RGBWColor;
/**
* Subsystem that controls an addressable LED strip using a CANdle.
*/
public class LEDSubsystem extends SubsystemBase {
private final CANBus kCANBus = new CANBus("rio");
private final CANdle m_candle = new CANdle(17, kCANBus);
public void Bleu(){
m_candle.setControl(new SolidColor(0, 80).withColor(new RGBWColor(255, 0, 0, 0)));
}
public void Rouge(){
new SolidColor(0, 80).withColor(new RGBWColor(0, 0, 255, 0));
}
public LEDSubsystem() {
setDefaultCommand(updateLEDs());
}
/**
* Updates the animations and LEDs of the CANdle.
*
* @return Command to run
*/
public Command updateLEDs() {
return run(() -> {});
}
}

View File

@@ -16,11 +16,8 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Led extends SubsystemBase {
ShuffleboardTab teb = Shuffleboard.getTab("teb");
@SuppressWarnings("removal")
CANdle CANDle = new CANdle(17);
@SuppressWarnings("removal")
RainbowAnimation rainbowAnim = new RainbowAnimation();
@SuppressWarnings("removal")
public void bleu(){
CANDle.setLEDs(0, 0, 255,0,0,8);
CANDle.setLEDs(0, 0, 255,0,16,8);
@@ -45,7 +42,6 @@ public class Led extends SubsystemBase {
// CANDle.setLEDs(0, 255, 0,0,120,8);
// CANDle.setLEDs(0, 255, 0,0,136,8);
}
@SuppressWarnings("removal")
public void Rouge(){
CANDle.setLEDs(255, 0, 0,0,0,8);
CANDle.setLEDs(255, 0, 0,0,16,8);
@@ -57,7 +53,6 @@ public class Led extends SubsystemBase {
// CANDle.setLEDs(255, 0, 0,0,112,8);
// CANDle.setLEDs(255, 0, 0,0,128,8);
}
@SuppressWarnings("removal")
public void Jaune2(){
CANDle.setLEDs(255, 255, 0,0,8,8);
CANDle.setLEDs(255, 255, 0,0,24,8);