Addressable LEDS

I am trying to use some addressable leds this year and to keep things simple I wanted to drive them using the roborio, but I am currently running into a problem. When I set the led buffer length I am getting an error ERROR 1 Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException: Code: -1028. Data length must be less than or equal to 1. 104 was requested frc.robot.subsystems.Lighting.setLEDColor(Lighting.java:51)
Lighting.java

When I call the set led color command in the robot container it just sends the error above and we cant seem to figure out why. Any ideas?

It looks like you’re missing a call to setLength. From the example code m_led.setLength(m_ledBuffer.getLength());

we added that in and its still sending that error

1 Like

Where did you add it? Can you repost the code?

Updated the Gist, m_lighting.setDefaultCommand(new RunCommand(() -> { if (getDesiredShooterSpeed() > 0) { m_lighting.setLightingState(LightingState.Shooting); } else { m_lighting.setLightingState(LightingState.Active); } if (m_lighting.getLightingState() == LightingState.Shooting) { if (m_shooter.upToSpeed()) { m_lighting.setLEDColor(133, 100, 100); } } else if (m_lighting.getLightingState() == LightingState.Active) { m_lighting.setLEDColor(120, 100, 100); } else if (m_lighting.getLightingState() == LightingState.Idle) { m_lighting.rainbow(); } }, m_lighting));

This is how im calling it in robot container

Ah… you don’t have a constructor. public void Lighting() is a method, not a constructor. So it’s not getting called. You need to remove the void.

Thank you for the help!! We also found we never called m_led.start() lol

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.