Changing the flight mode from stabilize to loiter or Altitude hold

Hello guys,

For the past three months I have been doing a project regarding obstacle avoidance of Quadcopter using 5 HC-SR04 ultrasonic sensor(front,back,left, right,top).When the copter encounters the obstacle in any one of the first four specified directions,Arduino uno has to give commands to apm board to change the flight mode from stabilizerd to loiter mode or brake mode.When copter encounter obstacle like ceiling it has to be changed to altitude hold.

Now i want to know how to coding in arduino to change mode in MAVlink format.I know i can use set_mode command…but i don’t know how to use it…any help is appreciated

Now i want to know how to coding in arduino to change mode in MAVlink format.I know i can use set_mode command....but i don't know how to use it...any help is appreciated

Do you have examples of the MAVlink command formats ?

Without them it is going to be impossible to provide help