The roboRIO only supports only 1 AddressableLED object. As WS2812B LEDs are connected in series, you can drive several strips connected in series from from AddressableLED object.
The current code on the FPGA only supports 1 AddressableLED object. It could be updated in the future, but its a fairly large change, and controlled by NI.
Would it be possible to simulate multiple AddressableLED objects by doing something like the following in the periodic function of a subsystem?
void periodic() {
// create AddressableLED at port 9
// set the colors
// call the close method on the object
// create AdressableLED at port 8
// set the colors
// close
}
I imagine performance might not be good because you’d need to call setLength twice in each call to periodic and the docs say that setLength is expensive and shouldn’t be called in periodic, but I’m just curious if something like that would even theoretically work. I can always try it on the robot next time I get a chance and see what happens.
It would be much easier and safer to just daisy chain the two strands (so you have one really long logical strand). You can have a pretty long run of signal+ground connecting between the two strands.
We were actually working on the same thing today. Currently we’re wiring all the power/ground to a voltage regulator and a single signal wire to a pwm port on the rio. Is this the correct way to go about doing this?
So, this actually probably won’t work. The FPGA continuously sends the data you last sent. This means that when you close the object, it can stop sending at any time during the send, which will leave you with a partially written strand, and the rest will potentially be garbage.
It will probably work if it’s a short run, but ideally you’d run a second ground wire to the Rio ground pin alongside the signal wire to the Rio. It’s all the same ground eventually, but running ground along the same path as signal provides a parallel return path for the signal current and improves the signal integrity.
We’ve been just using the REV Servo Power Module (Servo Power Module - REV Robotics). Since it passes the signal wire as-is without any changes so wiring wise, it’s a clean wiring run.