Our team has been trying to wire and program LED strips (BTF-Lightning WS2812B) for our competition bot. We successfully were able to get the LEDS working and were able to change the colors and create patterns. Then one of our team members had raised up the strip and while they did that it broke. All of the lights turned off except one blue and one red one. We were setting it to green and purple at the time. After it broke we measured the voltage at the end and between the positive and ground pads. There was about 3.8 volts when it is a 5volt LED strip. It also had continuity from the end of the signal strip to the port in the PWM. We are powering through the VRM. We had tried another strip from the same wires in case we broke the first one but it wouldn’t even turn on. At one point we were trying to set it to white and some lights at the end opposite the wires turned on but then when we redployed code they turned off and we couldn’t get them back on.
In the image the 5 volt is connected to the red port on the 5v/2A on the VRM the signal is connected to the S on the PWM and the ground is connected to the black on the 5V/2A on the VRM. Here is our code:
AddressableLED m_led;
AddressableLEDBuffer m_ledBuffer;
@Override
public void robotInit() {
m_led = new AddressableLED(4);
// Reuse buffer
// Default to a length of 60, start empty output
// Length is expensive to set, so only set it once, then just update data
m_ledBuffer = new AddressableLEDBuffer(15);
m_led.setLength(m_ledBuffer.getLength());
// Set the data
m_led.setData(m_ledBuffer);
m_led.start();
// Instantiate our RobotContainer. This will perform all our button bindings,
// and put our
// autonomous chooser on the dashboard.
m_robotContainer = new RobotContainer();
}
/**
* This function is called every 20 ms, no matter the mode. Use this for items
* like diagnostics
* that you want ran during disabled, autonomous, teleoperated and test.
*
* <p>
* This runs after the mode specific periodic functions, but before LiveWindow
* and
* SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
for (int i = 0; i < m_ledBuffer.getLength(); i++) {
// Sets the specified LED to the RGB values for red
m_ledBuffer.setRGB(i, 255, 255, 255);
}
m_led.setData(m_ledBuffer);
CommandScheduler.getInstance().run();
}