Controlling apm 2.6 with arduino

Hello all,
I am working on a project with the apm 2.6 and want to be able to use an arduino to control the flight of my quadcopter. I also want to be able to use my radio to control the copter as well. I want to be able to fly the quad into the air with the radio and then flip a switch and let the arduino do all of the flying. Then, when I flip the switch again, I can fly the quad manually with the radio again. I could just connect the reciever to the arduino and then send the signals to the flight controller from there, but I was wondering if there was a way to configure the apm so that you can control the roll, pitch, throttle, yaw and modes from both the inputs and another way such as the optional i/o pins or the analog input pins?

You can control APM through MAVLink.
See here:
And here:

You should also have a look at the code of Mission Planner here:
Especially the joystick control should be interesting for you.