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?
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.
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:
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