Files
Reefscape-2025/src/main/java/frc/robot/subsystems/Bougie.java

105 lines
3.3 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;
import com.ctre.phoenix.led.CANdle;
import com.ctre.phoenix.led.CANdleConfiguration;
import com.ctre.phoenix.led.FireAnimation;
import com.ctre.phoenix.led.LarsonAnimation;
import com.ctre.phoenix.led.RainbowAnimation;
import com.ctre.phoenix.led.TwinkleAnimation;
import com.ctre.phoenix.led.TwinkleOffAnimation;
import com.ctre.phoenix.led.TwinkleOffAnimation.TwinkleOffPercent;
import com.ctre.phoenix.led.LarsonAnimation.BounceMode;
import com.ctre.phoenix.led.TwinkleAnimation.TwinklePercent;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Bougie extends SubsystemBase {
CANdle candle = new CANdle(23);
CANdleConfiguration config = new CANdleConfiguration();
LarsonAnimation rainbowAnim = new LarsonAnimation(256,0,0,0,0.1,68,BounceMode.Front,10,8);
//TwinkleOffAnimation rainbowAnim = new TwinkleOffAnimation(256, 0, 0,0,0.5,68,TwinkleOffPercent.Percent88,8);
int led = 16;
int led2 = 8;
boolean x =true;
/** Creates a new Bougie. */
public Bougie() {
config.brightnessScalar = 0.5;
candle.configAllSettings(config);
}
public void Rouge() {
if(x){
candle.setLEDs(255, 0, 0,0,led,8);
led++;
candle.setLEDs(0, 0, 0,0,led2,8);
led2++;
System.out.println("led monte");
System.out.println(led);
if(led>=68){
x=false;
System.out.println("true");
System.out.println(x);
}
}
if(!x){
candle.setLEDs(255, 0, 0,0,led2,8);
led2--;
candle.setLEDs(0, 0, 0,0,led,8);
led--;
System.out.println("leds descendent");
if(led==15){
x=true;
System.out.println("false");
}}
// candle.setLEDs(255, 0, 0,0,24,8);
// candle.setLEDs(255, 0, 0,0,40,8);
// candle.setLEDs(255, 0, 0,0,56,8);
// candle.setLEDs(255, 0, 0,0,72,8);
// candle.setLEDs(255, 0, 0,0,88,8);
// candle.setLEDs(255, 0, 0,0,104,8);
// candle.setLEDs(255, 0, 0,0,120,8);
}
public void Vert() {
candle.setLEDs(0, 255, 0,0,8,8);
candle.setLEDs(0, 255, 0,0,24,8);
candle.setLEDs(0, 255, 0,0,40,8);
candle.setLEDs(0, 255, 0,0,56,8);
candle.setLEDs(0, 255, 0,0,72,8);
candle.setLEDs(0, 255, 0,0,88,8);
candle.setLEDs(0, 255, 0,0,104,8);
candle.setLEDs(0, 255, 0,0,120,8);
}
public void Bleu() {
candle.setLEDs(0, 0, 255,0,16,8);
candle.setLEDs(0, 0, 255,0,32,8);
candle.setLEDs(0, 0, 255,0,48,8);
candle.setLEDs(0, 0, 255,0,64,8);
candle.setLEDs(0, 0, 255,0,80,8);
candle.setLEDs(0, 0, 255,0,96,8);
candle.setLEDs(0, 0, 255,0,112,8);
}
public void Jaune() {
candle.setLEDs(255, 215, 0,0,16,8);
candle.setLEDs(255, 215, 0,0,32,8);
candle.setLEDs(255, 215, 0,0,48,8);
candle.setLEDs(255, 215, 0,0,64,8);
candle.setLEDs(255, 215, 0,0,80,8);
candle.setLEDs(255, 215, 0,0,96,8);
candle.setLEDs(255, 215, 0,0,112,8);
}
public void RainBow(){
candle.animate(rainbowAnim);
}
public void RainBowStop(){
candle.animate(null);
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}