Pulse reading and its delay in the program loop

Hi guys!
I have a simple question about the pulse reading.
Well, i'm trying to work with my RC tx on the arduino, everything seemed to work fine but then i found an anoying problem.
The information the Rx delivers is (as most of you should know) in 2ms pulses.
Its pulses normally makes run a servo.
But i'm trying to read 3 or maybe 4 channels at the same time.
And here we are: my loop is very slow to complete a full run.
I think the problem is on the time the cpu keep waiting for the pulses to be readen.

I took the base code from the arduino page, that "PulseIn" example.
Well, i'm wondering if there is a solution to keep reading the channels but not waiting too much for the pulses,
because we're working with pulses of just 2 ms (i think the arduino normally waits for 1 second before emitting an response);
If i use the timeout function, can I make the code to run faster, without time being lost in non necessary waiting of pulses?
If so, how much time should i put on the timeout ? Just the 2ms of lenght of the pulses?

thank you guys

I have a program on this that works relatively quick, at least quick enough for a quadcopter. What is it for? Pls post your program as well.

Where is this code?

Read this before posting a programming question

How to use this forum

Sorry for not posting the code. Here is it

unsigned long ch3 = 0;
unsigned long ch5 = 0;
int acelerador = 0;
void setup()
{
Serial.begin (9600);
pinMode(7, INPUT);
pinMode(6, INPUT);
}

void loop()
{
ch3 = pulseIn(7, HIGH);
//Serial.println (ch3);
acelerador = map(ch3, 960, 1865, 0, 255);
if (ch3 <= 980) {
acelerador = 0;
}
analogWrite (3, acelerador);
//Serial.println (sinal);

ch5 = pulseIn(6, HIGH);
Serial.println(ch5);
if (ch5 >= 1500){
analogWrite (5, 255);
}
if (ch5 <= 1500){
analogWrite (5, 0);
}

}

Its a simple code, just converting the pulses to an analog output wich is connected to the PWM controller.

Its for a homemade rc boat. It just need to control two things: the acelerator and another channel that I plan
to use as fase inversor with relays (to engage the reverse movement of the brushed motor).

Well, I want to add some other things if possible without slowing the program too much.

Please use code tags.

Read this before posting a programming question

What is the pulseIn for?

A servo signal is a 1 to 2mS pulse every 20ms. Use a timeout of greater than 20000uS.

Ok, guys… so here I am again.
Just had a look in the forum and some pages on the web. Just found what I needed to know and my code is
running perfecly.
It’s here:

unsigned long ch3 = 0;
unsigned long ch5 = 0;
unsigned long ch7 = 0;
int acelerador = 0;
int sensor = 0;
void setup()
{
  Serial.begin (9600);
  pinMode(2, INPUT);
  pinMode(3, INPUT); 
  pinMode(4, INPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
}

void loop(){
  ch3 = pulseIn(2, HIGH, 20000);
  acelerador = map(ch3, 980, 1980, 0, 255);
  if (ch3 <= 990) {
   acelerador = 0; 
  }
  if (ch3 >= 2000){
   acelerador = 0; 
  }
  analogWrite (5, acelerador);
  
  ch5 = pulseIn(3, HIGH, 20000);
  Serial.println(ch5);
  if (ch5 >= 1500 & ch5 <= 2000){
   digitalWrite (6, HIGH); 
  }
      else analogWrite (6, LOW);
      
    
  ch7 = pulseIn(4, HIGH, 20000);
  if (ch7 <= 2000 & ch7 >= 1200){
   digitalWrite (7, HIGH);
  }
  else digitalWrite(7, LOW);
}

Very simple. And also added some safe lines for when the radio is turned off.
The arduino was getting bad reads but now its fine.
Thanks anyway for the replies :stuck_out_tongue: