Skip to content

Commit

Permalink
finished led command
Browse files Browse the repository at this point in the history
  • Loading branch information
RamiRedShift committed Feb 27, 2024
1 parent f632fc4 commit 14a162f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/frc/robot/commands/LED.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@ public class LED extends Command{

private AddressableLED m_led;
private AddressableLEDBuffer m_ledBuffer;
private int h = 0;
private int s = 0;
private int v = 0;

@Override
public void initialize() {

// 9 is the PWM port
m_led = new AddressableLED(9);
// m_led = new AddressableLED(9);

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

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

setColor(0,100, 100);

setColor(h, s, v);

m_led.setData(m_ledBuffer);
}
Expand All @@ -35,10 +37,14 @@ public void setColor(int h, int s, int v) {
}
}

public LED(AddressableLED m_led, AddressableLEDBuffer m_ledBuffer) {
public LED(AddressableLED m_led, AddressableLEDBuffer m_ledBuffer, int h, int s, int v) {

this.m_led = m_led;
this.m_ledBuffer = m_ledBuffer;
this.h = h;
this.s = s;
this.v = v;

}


Expand Down

0 comments on commit 14a162f

Please sign in to comment.