Hello. I wish to ask about the delay time between two consecutive analogread() functions.
In one example program in the Arduino IDE, I saw a delay of 10 ms and in another, 1 ms as delay between reads for stability.
Is there a procedure to choose the delay time?
Thanks.
..there is no need for a delay at all.
Normally, 2 consecutive analogReads of the same pin, with the first read ignored, is all you need for a single pin to settle, if there are large differences in values between 2 pins being read, especially if the analog source is high impedance and can't drive the Arduino's internal sample & hold capacitor to change levels quickly.
Hello. Thanks. No, not to same pin, but to A0 and A3 pins.
CrossRoads:
Normally, 2 consecutive analogReads of the same pin, with the first read ignored, is all you need for a single pin to settle, if there are large differences in values between 2 pins being read, especially if the analog source is high impedance and can't drive the Arduino's internal sample & hold capacitor to change levels quickly.
Only if the source impedance is > 10k do you need to read twice.
The time between reads depends on the bandwidth you need to sample. To avoid aliasing/noise there's often
a need to add an RC LPF to the input too.