-
I am setting up a program to run on a Raspberry PI 4 (2G ram), written in Java. The OS image installation is from Pi4J https://pi4j.com I need to be able to output my LED string colours to the PWM port, ideally both. I also am planning to use a multiplexor, so I need to be able to toggle the four address pins. I have looked through your project, and I have extracted the classes which flow from the AddressableLED class:
And here I am stuck. Following the execution path leads me to a supposed dead end, that is an interface. There is no code to be executed, just:
Obviously it works, But I am at a loss to what I am missing. I know that the library is there for controlling a robot, but I only need to LED strip code, and some way to toggle the multiplexor address pins. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I do not recommend attempting to use WPILib as an example for controlling Addressable LEDs. As you've noticed, WPILib uses JNI to interface with C++ components of WPILIb, and these further interface with the closed source Network Communication module and FPGA image provided by NI for the roboRIO. The actual LED timing is handled in the FPGA. I would recommend searching for other examples closer to what you are trying to do, usually by searching the LED part number you are using + "Raspberry pi" such as "WS2812b raspberry pi". |
Beta Was this translation helpful? Give feedback.
-
If you are on a Raspberry Pi, I would recommend using Python. Here's an example https://github.com/CtrlZ-FRC4096/Robot-2023-Public/blob/main/rpi/leds/robot_leds1.py Also, have you considered just running your LEDs off of the roborio, where addressableled is supported? |
Beta Was this translation helpful? Give feedback.
As said above, the LED code here is written for a very specific piece of hardware that is not a raspberry pi. So you’d need to look up ws2812 Java libraries that are supported on raspberry pi.