need to switch 2 rc channels

Hi, New to all this, but very interested to learn, my reason for getting into Arduino is that I need to be able to switch the control of 1 joy stick on a standard 2.4 RC (2 channels) between 2 separate sets of servos by using the 5th channel switch normally reserved for undercarriage ect.
I'm building an excavator and I want 1 joystick to switch between digging arm and tracks at the flick of a switch.

Would I be able to use a standard UNO or something smaller, I don't need to switch motor current as I'm using ESC's,

Any help much appreciated.


What you want to do is quite possible using a Uno or smaller Arduino.
If the joystick is 2 axis rather than 1 you will have 3 RC channels. Wire each of the 3 RC outputs to digital input pins on the Arduino and connect a common GND between the RC Rx and Arduino. Read the auxiliary channel input using the pulseIn() function and switch the inputs between 2 sets of 2 outputs depending on the length of pulse received.

pulseIn() is not usually the best way to read an RC channel as it blocks operation of the Arduino but will probably be OK for what you want to do. If it does cause problems then you can switch to other, more responsive methods such as interrupts.

Pseudo code for what you want to do

start of loop()
  read aux channel
  if on
    read X input and write value to X1 output
    read Y input and write value to Y1 output
  end if
    read X input and write value to X2 output
    read Y input and write value to Y2 output
  end else  
end of loop()

As well as what @UKHeliBob said you will probably need to maintain the signal on the uncontrolled output to prevent that servo from jittering. That would be easy to do using the Servo library.


There are other considerations too. Suppose that the digging arm is in the fully raised position, presumably with the joystick pulled fully towards the operator. I assume that when you switch to controlling the tracks you do not want the excavator to go immediately into reverse. You might also want to arrange that the excavator and arm are not moving when you switch control between them.

Don't worry too much about these problems at the moment. Get the switching of channels working first.

Thank you all very much for your replies and advice. I will give it a try and let you know the out come.

Thanks again

If/when you post your code please take note of the advice in this thread about the use of code tags.
read this before posting a programming question