mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 00:38:00 -06:00
Merge pull request #58 from Team4388/improve-led-subsystem
button box fix LED
This commit is contained in:
@@ -17,6 +17,7 @@ import frc4388.utility.LEDPatterns;
|
|||||||
public class LED extends SubsystemBase {
|
public class LED extends SubsystemBase {
|
||||||
|
|
||||||
public static float currentLED;
|
public static float currentLED;
|
||||||
|
public static float defaultLED;
|
||||||
public static Spark LEDController;
|
public static Spark LEDController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +26,8 @@ public class LED extends SubsystemBase {
|
|||||||
*/
|
*/
|
||||||
public LED(){
|
public LED(){
|
||||||
LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
||||||
setPattern(LEDConstants.DEFAULT_PATTERN);
|
defaultLED = LEDConstants.DEFAULT_PATTERN.getValue();
|
||||||
|
runDefaultLED();
|
||||||
LEDController.set(currentLED);
|
LEDController.set(currentLED);
|
||||||
System.err.println("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
|
System.err.println("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
|
||||||
}
|
}
|
||||||
@@ -38,6 +40,37 @@ public class LED extends SubsystemBase {
|
|||||||
LEDController.set(currentLED);
|
LEDController.set(currentLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void runDefaultLED() {
|
||||||
|
setPattern(defaultLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the default LED by an amount
|
||||||
|
* @param amount the amount to increment led by
|
||||||
|
*/
|
||||||
|
public void incrementLED(float amount) {
|
||||||
|
defaultLED += amount;
|
||||||
|
if (defaultLED > 1) {
|
||||||
|
defaultLED -= 2;
|
||||||
|
}
|
||||||
|
if (defaultLED < -1) {
|
||||||
|
defaultLED += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current LED pattern. This method should only be run
|
||||||
|
* whenever you want to change the current LED.
|
||||||
|
* @param pattern LEDPattern to set the Blinkin to.
|
||||||
|
*/
|
||||||
|
public void setPattern(float pattern){
|
||||||
|
currentLED = pattern;
|
||||||
|
LEDController.set(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current LED pattern. This method should only be run
|
* Sets the current LED pattern. This method should only be run
|
||||||
* whenever you want to change the current LED.
|
* whenever you want to change the current LED.
|
||||||
|
|||||||
Reference in New Issue
Block a user