Skip to content

Commit

Permalink
LED flash command made
Browse files Browse the repository at this point in the history
  • Loading branch information
Merridew1 committed Dec 7, 2024
1 parent 26bf8f0 commit 6d66eb8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/frc/robot/subsystems/LEDs.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import edu.wpi.first.wpilibj.AddressableLED;
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
Expand Down Expand Up @@ -115,6 +116,21 @@ public Command flashCommand(Color color, Color altColor) {
return Commands.runEnd(null, null, null);
}

public void flash(Color color, Color altColor) {
Timer timer = new Timer();
for (int i = 0; i < 3; i++) {
if (i % 2 == 0) {
setColor(color);
timer.start();
} else {
setColor(altColor);
timer.start();
}
timer.advanceIfElapsed(.25);
timer.reset();
}
}


}

0 comments on commit 6d66eb8

Please sign in to comment.