Skip to content

Commit

Permalink
Update LED.java
Browse files Browse the repository at this point in the history
  • Loading branch information
RamiRedShift committed Feb 24, 2024
1 parent 80feb71 commit 2952cd2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/main/java/frc/robot/subsystems/LED.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
package frc.robot.subsystems;

import edu.wpi.first.wpilibj.AddressableLED;
import edu.wpi.first.wpilibj.AddressableLEDBuffer;

public class LED {

public void robotInit() {
// 9 is the PWM port
m_led = new AddressableLED(9);

// Default length of 60 starting with empty output
m_ledBuffer = new AddressableLEDBuffer(60);
m_led.setLength(m_ledBuffer.getLength());

// seting the data
m_led.setData(m_ledBuffer.getLength());
m_led.start();
}

for(

var i = 0;i<m_ledBuffer.getLength();i++)
{
// looping between red and black
while (true) {
m_ledBuffer.setHSV(i, 1, 100, 64);
wait(5);
m_ledBuffer.setHSV(i, 0, 0, 0);
wait(5);
}
}

m_led.setData(m_ledBuffer);
}

0 comments on commit 2952cd2

Please sign in to comment.