I am currently trying to figure out how to control addressable leds using java by connecting an led strip into the roborio. I have been having trouble getting things to work and was wondering if anyone knows of a team that has done it withouth the use of a blinkin or an arduino.
has code examples
I have looked at it and even tried running the example program but it doesnt work.
2 questions. Are you upgraded to WPILib 2022.3.1 and the v4.0 roboRIO image? Those are both required to have LEDs working. And its hooked up to the PWM port matching the number you put in code, not the DIO port? It has to be plugged into one of the PWM ports to work.
I dont think the laptop i was working with was updated so I will try that and yes, the led was in the corresponding pwm port.
How are you powering the LED strip?
In addition to the questions others are asking, it would be good to make sure that the LED strip you’re using is a supported one. There are different LED strips, some of which are compatible (those based on the WS 2812 chip and perhaps others) and others are not: for example, those based on the SK9822 chip. A link to the product description for your LEDs, a link to your code, and a picture of how the strip is wired would all be helpful.
Here is our working LED subsystem. This assumes version >=3.1.
Another thought is to try to use the simulation capabilities of the WPI ecosystem to see whether the code works. This would help separate a programming problem from a hardware/wiring problem.
Simulation has really been the most reliable teaching/testing tool for my students this year. I can’t say that often enough.
The LED examples from WPILib should run in the simulation just fine.
Just do Create New Project, choose Example, start typing LED to filter the text and the Addressable LED example project will be generated.
Run that in the simulator, make whatever changes you’re wanting to make, then you know the code is roughly ready for a robot.
If you deploy on your robot and it doesn’t work, you can guarantee it’s something in physical layer of the robot (wiring, wrong PWM port, not being powered properly, etc).
Thank you for suggesting this idea, I have written new code and can confirm that it works. I will try doing this with an actual LED strip tomorrow.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.