led
This commit is contained in:
39
src/main/java/frc/robot/subsystems/LEDSubsystem.java
Normal file
39
src/main/java/frc/robot/subsystems/LEDSubsystem.java
Normal 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(() -> {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user