led subsystem
This commit is contained in:
		
							
								
								
									
										37
									
								
								src/main/java/frc/robot/Bougie.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/main/java/frc/robot/Bougie.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | |||||||
|  | // 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; | ||||||
|  |  | ||||||
|  | import com.ctre.phoenix.led.CANdle; | ||||||
|  | import com.ctre.phoenix.led.CANdleConfiguration; | ||||||
|  | import com.ctre.phoenix.led.RainbowAnimation; | ||||||
|  |  | ||||||
|  | import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  |  | ||||||
|  | public class Bougie extends SubsystemBase { | ||||||
|  |   CANdle candle = new CANdle(5); | ||||||
|  |   CANdleConfiguration config = new CANdleConfiguration(); | ||||||
|  |   RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64); | ||||||
|  |   /** Creates a new Bougie. */ | ||||||
|  |   public Bougie() { | ||||||
|  |     config.brightnessScalar = 0.5; | ||||||
|  |     candle.configAllSettings(config); | ||||||
|  |   } | ||||||
|  |   public void Rouge() { | ||||||
|  |    candle.setLEDs(255, 0, 0); | ||||||
|  |   } | ||||||
|  |   public void Vert() { | ||||||
|  |    candle.setLEDs(0, 255, 0); | ||||||
|  |   } | ||||||
|  |   public void Bleu() { | ||||||
|  |    candle.setLEDs(0, 0, 255); | ||||||
|  |   } | ||||||
|  |   public void RainBow(){candle.animate(rainbowAnim);} | ||||||
|  |   @Override | ||||||
|  |   public void periodic() { | ||||||
|  |     // This method will be called once per scheduler run | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
| @@ -39,12 +39,7 @@ public class RobotContainer { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void configureBindings() { |     private void configureBindings() { | ||||||
|         // Note that X is defined as forward according to WPILib convention, |  | ||||||
|         // and Y is defined as to the left according to WPILib convention. |  | ||||||
|        |  | ||||||
|  |  | ||||||
|         // Run SysId routines when holding back/start and X/Y. |  | ||||||
|         // Note that each routine should be run exactly once in a single log. |  | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user