Sending mavlink command to pixhawk with Arduino

Hello, I want to control servo by sending mavlink command from arduino to pixhawk. The mavlink command I need to use is “MAV_CMD_DO_SET_SERVO” but I couldn’t find any good sample code on how to send it to pixhawk. If anyone knows how to do this, please share a working example code with me. Thank you in advance.


Thanks, I have reviewed this resource, but what I am trying to do is not to control the servo. I want is to send a Mavlink command to pixhawk with arduino.

This statement is self-contradictory.
First you’re saying:

And then you’re saying:

The resources I shared is totally useful for your case.
First one explains the servo set command and the second one is how to build a mavlink message and send it from Arduino to ArduPilot.
If you want further help, please give us more details about what you want to accomplish :slightly_smiling_face: