using gears to move fan up and down and side to side

I am starting a project where I want to rotate my fan up and down and side to side with an app in my cellphone. I am using a motor I took off a remote control car. The motor has two axial one on each side coming out of it. When the motor is powered on both axial spin so I was thinking of using this just one motor to conduct both actions ( The up and down movement and side to side) with gears. the problem is how can I conduct just one action at a time. For example just move the fan up and down without moving it side to side. I was thinking of attaching gears on the motor, I will put two gears at both ends of the motor and then I thinking for the gears that will be at top where the fan is at I can suspend them according to the action I want to conduct. For example if I wish to move the fan just side to side I will suspend the according gears to come in contact with the gear at the end of the motor and although both ends of the motor are spinning only one side is in contact so therefore it's just conducting one action. I don't know is there is a type of suspension or tool I can build to allow the gears to do this that work well with the arduino.

Or any other ideas for using this one motor to separate the action of moving the fan up and down, and side to side would be appreciated as well.

A pan and tilt platform with servo control.