It's my first topic on the forum, so I'm very sorry if my question is not exactly in the right place. I have an Arduino Nano(ATmega168). As you can see in the attached picture, I tried to connect two potentiometers (5K) two the pins A2 and A4. If I turn the knob attached to A4, for some reason, only the value of A2 changes. If I turn the knob attached to A4, nothing happens, except for a little bit higher values beginning to appear, if I hold my finger on it. Sorry, if it's a very newbie question with an obvious solution. I would be really happy to receive an answer from you! Thank you!
int X = 0;
int Y = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
X = analogRead(A2);
Y = analogRead(A4);
Serial.println(X);
Serial.print(" A2 - ");
Serial.println(Y);
Serial.print(" A4 - ");
delay(500);
}
You're possibly reading the two inputs too fast. There's really only one ADC and it needs time to recover after a read. You could try putting a small delay() between the reads or perhaps just reading A2 then printing it and after that reading A4 and printing it would do.
Sorry, the ground rails in the image were jumped with bare tinned wires so did not show up very well. Thanks for pointing that out. I fixed the image so that black jumpers connect the ground rails.