About gimbal control

I am using pixhawk2. arducopter 3.6.9
I want to control the tilt and fan of the gimbal.
Is it possible use main out or aux out port without using RC?
I tried to output pwm to main out and aux out using mavlink, but it failed.

help me please.

you can use aux channels as you wished

set the channel(that you want to use) function => RC pass thru

and set your transmitter mixer as you want to use.

As i know you cant control gimbal directly without using rc channels.
But If you’re wanting to stabilize your gimbal, the Pixhawk can do that automatically (see http://copter.ardupilot.com/wiki/camera-mount/).

Otherwise, you can use waypoints to pre-program the gimbel to point at a specific location during flight (http://copter.ardupilot.com/wiki/common-planning-a-mission-with-way…).

If you want full manual control, you can use the “servo” tab within the flight data view in Mission Planner.