-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from noodleeater99/main
LED code v1 TEST
- Loading branch information
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.constants.LEDConstants; | ||
import frc.robot.subsystems.LEDSubsystem; | ||
|
||
public class SetLEDCommand extends Command { | ||
private static LEDSubsystem subsystem = null; | ||
public SetLEDCommand(LEDSubsystem subsystem) { | ||
this.subsystem = subsystem; | ||
} | ||
|
||
//@Override | ||
public static void run(LEDConstants.Status currentStatus) { | ||
switch(currentStatus) { | ||
case TEST_1: | ||
//Confetti | ||
subsystem.setLED(-0.87); | ||
case TEST_2: | ||
//Sinelon, Forest Palette | ||
subsystem.setLED(-0.71); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package frc.robot.constants; | ||
|
||
public class LEDConstants { | ||
public static enum Status { | ||
DISABLED, | ||
IDLE, | ||
MOVING, | ||
VISION_MOVING, | ||
TEST_1, | ||
TEST_2 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package frc.robot.subsystems; | ||
|
||
import edu.wpi.first.networktables.DoublePublisher; | ||
import edu.wpi.first.networktables.NetworkTableInstance; | ||
import edu.wpi.first.wpilibj.motorcontrol.Spark; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class LEDSubsystem extends SubsystemBase { | ||
Spark BlinkinDriver = new Spark(9); | ||
DoublePublisher LED_NT = NetworkTableInstance.getDefault().getTable("LEDs").getDoubleTopic("LEDValue").publish(); | ||
@Override | ||
public void periodic() { | ||
super.periodic(); | ||
LED_NT.set(BlinkinDriver.get()); | ||
} | ||
public void setLED(double value) { | ||
BlinkinDriver.set(value); | ||
} | ||
} |