I'm sure the double dead of A0 doesn't help
int analogValue = analogRead(A0); // <=========== First read
if (analogValue > threshold) {
frqA = map(analogRead(A0), 0, 4095, 0, 4092); // <=========== Second read
}
else
@OP: I suggest you change
frqA = map(analogRead(A0), 0, 4095, 0, 4092);
to
frqA = map(analogValue, 0, 4095, 0, 4092);
for two reasons:
- analogRead is slow and blocking. So it is best to minimize their use.
- the value may change on a second read. The original premise of the thread was questioning analog read stibility