Help decide wich method to read 3ch - R\C Receiver

First of all i would like to say that Im pretty new to arduino.

I learned and searched evrything i could to try and decide what is the best method for my needs to read only 3 channels from my R\C receiver.

I am building some sort of channels multiplexer, i have a 7ch Tx and i need the extra channels but its also something that a transmitter with more channels wont help me to control, and ill explain.

My goal is to read 3 channels:
first channel is a 3-way toggle switch (lets say it will output 1000uS, 1500uS, 2000uS)
the other two are a proportional channels that will control diffrent things.
and i need to output the signals to 6 servos.

the 3-way toggle switch will determines wich servos the 2 inputs will control, and it will have for start the failsafe output, and it will remember the last command given when i switch the toggle.

im looking for start after 100 steps\sec.

I have read about the Pulsein function but i understand it might not fit my needs, because evrytime i call this function is sort of stop doing evrything else?

so i tried learning about interrupts and i came a cross a few codes and i managed to write the following code:

#include <Servo.h>
#define NBR_SERVOS 2 // the number of servos, up to 48 for Mega, 12 for other boards

Servo Servos[NBR_SERVOS] ;

// define number of times to check the ppm readings
int maxlim=10;

int PPMin1 = 2; // connect the desired channel (PPM signal) from your RC receiver to digital pin 2 on Arduino.
int PPMin2 = 3;

volatile int RCval1; // store RC signal pulse length
volatile int lastgood1;
volatile int adj_val1;

volatile int RCval2; // store RC signal pulse length
volatile int lastgood2;
volatile int adj_val2;

volatile unsigned long RC1PulseStartTicks;
volatile int RC1InputReady;
volatile int rcval1_prev;

volatile unsigned long RC2PulseStartTicks;
volatile int RC2InputReady;
volatile int rcval2_prev;

// declare array for checking ppm signal
volatile unsigned int ppmreads1[10];
volatile unsigned int ppmreads2[10];

volatile unsigned int ppm_buf_i;
volatile unsigned int ppm_buf_x;

// define int for count
volatile unsigned int pinr1=0;
volatile unsigned int pinr2=0;

volatile unsigned int match = 0;

void setup() {

for( int i =0; i < NBR_SERVOS; i++) { Servos*.attach( FIRST_SERVO_PIN +i, 800, 2200);}*
// pinMode(13, OUTPUT);

  • //PPM inputs from RC receiver*

  • pinMode(PPMin1, INPUT); //Pin 2 as input*

  • pinMode(PPMin2, INPUT); //Pin 3 as input*

  • attachInterrupt(0, rc2, CHANGE); // catch interrupt 0 (digital pin 2) going HIGH and send to rc1()*

  • attachInterrupt(1, rc1, CHANGE); // catch interrupt 1 (digital pin 3) going HIGH and send to rc2()*
    void rc1()

  • // did the pin change to high or low?*

  • if (digitalRead( PPMin1 ) == HIGH)*

  • {*

  • // store the current micros() value*

  • RC1PulseStartTicks = micros();*

  • }*

  • else*

  • {*

  • // Pin transitioned low, calculate the duration of the pulse*

  • ppmreads1[pinr1]= micros() - RC1PulseStartTicks; // may glitch during timer wrap-around*

  • pinr1=pinr1++;*

  • if (pinr1>=(maxlim-1)) {*

  • // check maxnum if 50% then ok*

  • for (int i=0; i < (maxlim-1); i++) {*

  • match = 0;*
    for (int x=0; x < (maxlim-1); x++) { ppm_buf_x=ppmreads1[x]; if (ppmreads1==ppmreads1) { match++; } }
    _ // if match greater then 50%
    // Serial.print(match);
    if (match>=4)
    // Set flag for main loop to process the pulse*
    * RCval1= ppm_buf_i;*
    * RC1InputReady = true;
    if (pinr1>=(maxlim-1)) { pinr1=0; }
    } // if digiread ppmin1*
    * }
    void rc2()
    // did the pin change to high or low?
    if (digitalRead( PPMin2 ) == HIGH)
    // store the current micros() value*
    * RC2PulseStartTicks = micros();
    * {
    // Pin transitioned low, calculate the duration of the pulse*
    * RCval2 = micros() - RC2PulseStartTicks; // may glitch during timer wrap-around*
    * // Set flag for main loop to process the pulse*
    * RC2InputReady = true;
    void loop() {
    * if (RC1InputReady)
    // reset input flag*
    * RC1InputReady = false;
    // constrain and map the pulse length*_

    * adj_val1 = constrain(RCval1, 1000, 2000);*

* // this is the place to write to the servo*
* Servos[0].writeMicroseconds(adj_val1);

* if (RC2InputReady)
// reset input flag*
* RC2InputReady = false;
// constrain and map the pulse length*
* adj_val2 = constrain(RCval2, 1000, 2000);*
// this is the place to write to the servo

* //print values*
// Serial.print("channel 1: ");
// Serial.println(adj_val2);
// /

The problem with the code is that i have a very low steps, and it seems that the interrupts reading are quite low and i cant understand why, i have the following options:
1. try to solve this code that will fit my needs (i also will build a failsafe function) and i need to work the code that i can get 100 steps\sec…
2. try to write a new code with pulsein function.
3. since my R\C is a futaba pcm Rx and i really cant use anything else that outputs PPM (unless someone know how can i hack my fut Rx), but i have the following device (8 Channel PPM Encoder
) that can combine my channels from my receiver to a ppm output, but that means that i need to use another device instead of just 1.
then ill use the servodecode and servotimer2 libaries to make this thing work.
so what do you guys think is the best option for me ?


sorry to dig that up but I do have a similiar task.

Did you find a solution for your problem?

Cheers Alexander