Skip to content

Commit

Permalink
Check for note when using LED, slowed down rainbow LED
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammingSR committed Mar 19, 2024
1 parent a8dc6f6 commit a0d6586
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/commands/DefaultLEDCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void initialize() {
armSetpoint = m_intakeSubsystem.getArmPosition();
if (armSetpoint == IntakeConstants.kIntakeLoweredAngle) {
rgb[0] = 255;
rgb[1] = 165;
rgb[1] = 0;
rgb[2] = 0;
} else if (armSetpoint == IntakeConstants.kIntakeRaisedAngle) {
} else if (armSetpoint == IntakeConstants.kIntakeRaisedAngle && m_intakeSubsystem.haveNote()) {
rgb[0] = 0;
rgb[1] = 0;
rgb[2] = 255;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/LEDSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public class LEDSubsystem extends SubsystemBase {
private final AddressableLED m_LED = new AddressableLED(LEDConstants.kLEDPort);
private final AddressableLEDBuffer m_LEDBuffer = new AddressableLEDBuffer(LEDConstants.kLEDLength);
private int m_rainbowFirstPixelHue = 0;

/** Creates a new {@link LEDSubsystem}. */
public LEDSubsystem() {
Expand Down Expand Up @@ -50,7 +51,6 @@ public void setLED(int r, int g, int b) {
}

private void rainbow() {
int m_rainbowFirstPixelHue = 0;
// For every pixel
for (var i = 0; i < m_LEDBuffer.getLength(); i++) {
// Calculate the hue - hue is easier for rainbows because the color
Expand All @@ -60,7 +60,7 @@ private void rainbow() {
m_LEDBuffer.setHSV(i, hue, 255, 128);
}
// Increase by to make the rainbow "move"
m_rainbowFirstPixelHue += 3;
m_rainbowFirstPixelHue += 1;
// Check bounds
m_rainbowFirstPixelHue %= 180;

Expand Down

0 comments on commit a0d6586

Please sign in to comment.