I wired up two 10k linear pots in the usual way (5v on one side gnd on the other and the center pin going to an analog input for each pot). Next I get the values with analogRead and serial print them.
Here’s the problem, the first pot reads fine, I get the values from 0 1023 but the second one always stays at 1023.
If I unplug it the input floats and gives random values so there’s a connection to the pot. Also I’ve switched the pots around and same happens on the same line (not same pot). I’ve also tried with different pins, same story. I even tried it on the arduino uno, teensy 2, and teensy 2++.
This is getting very frustrating I’ve looked at a ton of similar projects measuring two pots like this and it seems to work for everyone straight of. Am I missing something here? Will putting caps somewhere help?
here’s my code:
int pin1 = A0;
int pin2 = A1;
int val1 = 0;
int val2 = 0;
val1 = analogRead(pin1);
val2 = analogRead(pin2);
Any help would be greatly appreciated!!