I want to make a "universal" infrared RC toy helicopter transmitter. I have a few helicopter models but they all have different protocols with different remote controls. So I want to make one transmitter for all the models I have.
The remote has to have two joysticks with two axis eachs. That means I will use 4 analog inputs on the arduino. The protocol requires that I transmit the state of all the axis roughly 10 times a second. So that means I have to call analogRead() at least 40 times a second. And that's my problem. If I have to call a delay(100) between each call to analogRead() I will not be able to send out the signal fast enough.
Is there any way I can get around this limitation?
I've been a programmer (C/C++) for almost 20 years, but I'm a beginner when it comes to electronics and microcontrollers.
// reads the value of the variable resistor
value1 = analogRead(joyPin1);
// this small pause is needed between reading
// analog pins, otherwise we get the same value twice
delay(100);
// reads the value of the variable resistor
value2 = analogRead(joyPin2);
That quote is so totally wrong. Sadly there is a lot of bad information on the web, and sadly some of it is on this site. That delay serves no purpose at all.
There is a case for putting a delay between two readings of the same input channel on inputs where the impedance is greater than 1K, but that quote is just rubbish.