AUX1 and AUX5 fault when using serial LEDs

Hi all,

I have some serial LEDs that I would like to drive using a LUA script. I’m using

local chan = SRV_Channels:find_channel(94)
if not chan then
  return
end
local num_leds = 6
serialLED:set_num_neopixel_rgb(chan, num_leds)
chan = chan + 1;

to init the LEDs and I’m using

serialLED:set_RGB(chan, 0, R[1], G[1], B[1])
serialLED:set_RGB(chan, 1, R[2], G[2], B[2])
serialLED:set_RGB(chan, 2, R[3], G[3], B[3])
serialLED:set_RGB(chan, 3, R[4], G[4], B[4])
serialLED:set_RGB(chan, 4, R[5], G[5], B[5])
serialLED:set_RGB(chan, 5, R[6], G[6], B[6])
serialLED:send(chan)

to set the LED’s collor.

This works fine when I set

SERVO10_FUNCTION = 94

or

SERVO11_FUNCTION = 94

or

SERVO12_FUNCTION = 94

or

SERVO14_FUNCTION = 94

However, it does not work when I set

SERVO9_FUNCTION = 94

or

SERVO13_FUNCTION = 94

Am I missing a servo parameter (that might disable SERVO9 and SERVO13)?

PS I noticed that SERVO9 and SERVO13 are both the first ports within their PWM group.

Thanks in advance!

Best regards,
Max

What if you use more than just 94 ? You have all the way through to 109, assign one sripting reference to each AUX output.
I havent tried it but, just trying to help.

Hi @xfacta,
Thanks for your message! Sorry for my late reply, I was on holiday.
I have tried 98 (instead of 94) and this shows the exact same behavior.

Did you try assigning 94, 95, 96… and so on to each AUX function and adjusting your script to handle each individually?

Hi @xfacta,

Sorry for my very late reply! I finally found some time to investigate this further.

I think that I found the problem. In the code below, I incremented the chan variable after calling the serialLED:set_num_neopixel_rgb(chan, num_leds) function. When I increment the chan variable before calling the serialLED:set_num_neopixel_rgb(chan, num_leds), everything works fine.

local chan = SRV_Channels:find_channel(94)
if not chan then
  return
end
local num_leds = 6
serialLED:set_num_neopixel_rgb(chan, num_leds)
chan = chan + 1;

So, the code becomes this:

local chan = SRV_Channels:find_channel(94)
if not chan then
  return
end
local num_leds = 6
chan = chan + 1;
serialLED:set_num_neopixel_rgb(chan, num_leds)

I’m not quite sure why I have made such a stupid mistake. This might have been changed in some Ardupilot software update, because I remember that the incrementation should be done after serialLED:set_num_neopixel_rgb(chan, num_leds). Anyway, it works now!