Files
Robot-Essentials/src/main/java/frc4388/robot/subsystems/LED.java
T

63 lines
1.7 KiB
Java
Raw Normal View History

2019-08-04 16:19:40 -06:00
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc4388.robot.subsystems;
import edu.wpi.first.wpilibj.Spark;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
2020-01-05 18:59:50 -07:00
import edu.wpi.first.wpilibj2.command.SubsystemBase;
2019-08-04 16:19:40 -06:00
import frc4388.robot.Constants.LEDConstants;
2020-01-05 20:23:52 -07:00
import frc4388.utility.LEDPatterns;
2019-08-04 16:19:40 -06:00
/**
2020-01-05 18:59:50 -07:00
* Allows for the control of a 5v LED Strip using a Rev Robotics Blinkin LED
* Driver
2019-08-04 16:19:40 -06:00
*/
2020-01-05 18:59:50 -07:00
public class LED extends SubsystemBase {
2019-08-04 16:19:40 -06:00
2020-03-28 23:16:04 -06:00
private LEDPatterns m_currentPattern;
private Spark m_LEDController;
2019-08-04 16:19:40 -06:00
/**
* Add your docs here.
*/
public LED(Spark LEDController){
m_LEDController = LEDController;
2020-01-05 21:26:49 -07:00
setPattern(LEDConstants.DEFAULT_PATTERN);
2020-03-28 23:16:04 -06:00
updateLED();
2019-12-27 15:34:53 -07:00
System.err.println("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
2019-08-04 16:19:40 -06:00
}
@Override
public void periodic(){
2020-03-28 23:16:04 -06:00
SmartDashboard.putNumber("LED", m_currentPattern.getValue());
}
/**
* Add your docs here.
*/
2019-12-21 20:41:34 -07:00
public void updateLED(){
2020-03-28 23:16:04 -06:00
m_LEDController.set(m_currentPattern.getValue());
2019-08-04 16:19:40 -06:00
}
/**
* Add your docs here.
*/
2019-08-04 16:19:40 -06:00
public void setPattern(LEDPatterns pattern){
2020-03-28 23:16:04 -06:00
m_currentPattern = pattern;
m_LEDController.set(m_currentPattern.getValue());
}
/**
* Add your docs here.
* @return
*/
public LEDPatterns getPattern() {
return m_currentPattern;
2019-12-21 20:41:34 -07:00
}
2019-08-04 16:19:40 -06:00
}