mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-09 00:38:01 -06:00
Create RobotMap to decouple Subsystems from their hardware.
With the hardware objects decoupled from the subsystems, we can then pass mock hardware into these subsystems to run simulations/tests on.
This commit is contained in:
@@ -20,36 +20,36 @@ import frc4388.utility.LEDPatterns;
|
||||
*/
|
||||
public class LED extends SubsystemBase {
|
||||
|
||||
private float currentLED;
|
||||
private Spark LEDController;
|
||||
private float m_currentLED;
|
||||
private Spark m_LEDController;
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public LED(){
|
||||
LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
||||
public LED(Spark LEDController){
|
||||
m_LEDController = LEDController;
|
||||
setPattern(LEDConstants.DEFAULT_PATTERN);
|
||||
LEDController.set(currentLED);
|
||||
m_LEDController.set(m_currentLED);
|
||||
System.err.println("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic(){
|
||||
SmartDashboard.putNumber("LED", m_currentLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public void updateLED(){
|
||||
LEDController.set(currentLED);
|
||||
m_LEDController.set(m_currentLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add your docs here.
|
||||
*/
|
||||
public void setPattern(LEDPatterns pattern){
|
||||
currentLED = pattern.getValue();
|
||||
LEDController.set(currentLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic(){
|
||||
SmartDashboard.putNumber("LED", currentLED);
|
||||
m_currentLED = pattern.getValue();
|
||||
m_LEDController.set(m_currentLED);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user