Skip to content

Commit

Permalink
Working LED color changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AceiusRedshift committed Mar 1, 2024
1 parent 4cf4503 commit a9fe756
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public RobotContainer() {
autoChooser.addOption("Rotate by 90", Autos.rotateTestAuto(drivetrain, 90, false));
autoChooser.addOption("Forward", Autos.driveAuto(drivetrain, +1));
autoChooser.addOption("Backward", Autos.driveAuto(drivetrain, -1));
autoChooser.addOption("Make LEDs blue", new SetLightstripColor(lightStrip, 94));
autoChooser.addOption("Make LEDs blue", new SetLightstripColor(lightStrip, 0.87));
autoChooser.addOption("Make LEDs red", new SetLightstripColor(lightStrip, 0.61));
SmartDashboard.putData("Auto Chooser", autoChooser);

configureBindings();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/commands/SetLightstripColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
public class SetLightstripColor extends Command {
private LightStrip lightStrip;

private int pattern;
private double pattern;

/**
* Set the color of the robot's lightstrip
*
* @param lightStrip The lightstrip you want to use (there should only be ONE)
* @param pattern Pattern
*/
public SetLightstripColor(LightStrip lightStrip, int pattern) {
public SetLightstripColor(LightStrip lightStrip, double pattern) {
this.lightStrip = lightStrip;
this.pattern = pattern;
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/frc/robot/subsystems/LightStrip.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class LightStrip extends SubsystemBase {
* +1 corresponds to 2000us
*/
private Spark ledStrip;
private int pattern;
private double pattern;

/**
* Creates a new LightStrip subsystem.
Expand All @@ -38,13 +38,14 @@ public LightStrip(int pwmPort) {
* @param pattern Pattern ID to use. Consult section 5 of the blinkin manual.
* @link https://www.revrobotics.com/content/docs/REV-11-1105-UM.pdf
*/
public void setPattern(int pattern) {
public void setPattern(double pattern) {
this.pattern = pattern;
}

@Override
public void periodic() {
System.out.println("*** Subsystem setting pattern to pattern number " + pattern);
// System.out.println("*** Subsystem setting pattern to pattern number " +
// pattern);
ledStrip.set(pattern);
}
}

0 comments on commit a9fe756

Please sign in to comment.