Programming LED with MAVLINK

Greeting!
Any useful help would be greatly appreciated!
https://ardupilot.org/copter/docs/common-serial-led-neopixel.html
Based on the link, I’m trying to get a Neopixel 8x8 board connected to Servo5 to work (Pixhawk 6C, firmware: ardupilot), I only want one color at a time, nothing complicated.

For example:
mav_connection.mav.command_long_send(system, component,
mavutil.mavlink.MAV_CMD_DO_SET_SERVO, 0, 5 # servo, 1500 pwm, 0, 0, 0, 0, 0)

I don’t know what colors can be produced with PWM. Nothing is working for now. I definitely want to control it from Python, not a LUA script.

Hello @Tomatila welcome to the community,

You can not control it from python, you must control it from lua. And neopixel LEDs use neopixel protocol, not PWM. That is why it is not working.

1 Like

yes, thank you, since then the picture is clearer

You’ll need a Lua script to do any significant customization of LED color or light pattern, but if you wanted to control them with an otherwise unused RC channel, you could write that into the Lua script and then send RC overrides with Python from the GCS (or poll an unused servo output for its value in Lua and use set servo, as in your example).

There are probably more elegant solutions within MavLink (especially given the new MavLink bindings in Lua), but those come to mind as easiest to comprehend and implement.