2021-11-15 16:26:16 -07:00
|
|
|
package frc4388.robot.subsystems;
|
|
|
|
|
|
2022-01-30 00:39:17 -07:00
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
|
2022-01-11 11:05:52 -07:00
|
|
|
import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
2021-11-15 16:26:16 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
|
|
|
import frc4388.robot.Constants.LEDConstants;
|
|
|
|
|
import frc4388.utility.LEDPatterns;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Allows for the control of a 5v LED Strip using a Rev Robotics Blinkin LED
|
|
|
|
|
* Driver
|
|
|
|
|
*/
|
|
|
|
|
public class LED extends SubsystemBase {
|
|
|
|
|
|
|
|
|
|
private LEDPatterns m_currentPattern;
|
2022-04-07 19:02:32 -06:00
|
|
|
// private PWM newLED;
|
|
|
|
|
private Spark m_LEDController;
|
2021-11-15 16:26:16 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add your docs here.
|
|
|
|
|
*/
|
2022-04-07 19:02:32 -06:00
|
|
|
public LED(Spark LEDController){
|
|
|
|
|
m_LEDController = LEDController;
|
|
|
|
|
// this.newLED = newLED;
|
2021-11-15 16:26:16 -07:00
|
|
|
setPattern(LEDConstants.DEFAULT_PATTERN);
|
|
|
|
|
updateLED();
|
2022-02-25 01:33:32 -07:00
|
|
|
Logger.getLogger(LED.class.getSimpleName()).finer("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
|
2021-11-15 16:26:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void periodic(){
|
2022-01-22 15:55:04 -07:00
|
|
|
//SmartDashboard.putNumber("LED", m_currentPattern.getValue());
|
2021-11-15 16:26:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add your docs here.
|
|
|
|
|
*/
|
|
|
|
|
public void updateLED(){
|
2022-04-07 19:02:32 -06:00
|
|
|
// newLED.setRaw((int) m_currentPattern.percentToPWM());
|
|
|
|
|
m_LEDController.set(m_currentPattern.getValue());
|
2021-11-15 16:26:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add your docs here.
|
|
|
|
|
*/
|
|
|
|
|
public void setPattern(LEDPatterns pattern){
|
|
|
|
|
m_currentPattern = pattern;
|
2022-04-07 19:02:32 -06:00
|
|
|
// newLED.setRaw((int) m_currentPattern.percentToPWM());
|
|
|
|
|
m_LEDController.set(m_currentPattern.getValue());
|
2021-11-15 16:26:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add your docs here.
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public LEDPatterns getPattern() {
|
|
|
|
|
return m_currentPattern;
|
|
|
|
|
}
|
2022-03-12 11:36:10 -07:00
|
|
|
|
2021-11-15 16:26:16 -07:00
|
|
|
}
|