donkeyahoy
Well-known member
Hello. I'm trying to analogRead a 10K potentiometer. The results are not steady. The last value is jittering, for example between 3459 and 3460. I'm using the 3.3V at the bottom of the Teensy 3.1 and the AGND near the upper right. The pots center wiper is going into pin 18. I also have a 100nF ceramic cap from pin 18 to AGND. This Teensy has its 5V pads cut apart and is externally powered with this 5.25V psu:
https://www.adafruit.com/products/501?gclid=CKfC_YXsor0CFQ8OOgod9F4AJQ
Windows 7, Arduino 1.6.11, Teensyduino 1.30
Is there anything I can do to stabilize these readings? Is it possible to get steady values from this setup and resolution or am I asking too much? Any ideas or tips would be greatly appreciated. Thanks!
https://www.adafruit.com/products/501?gclid=CKfC_YXsor0CFQ8OOgod9F4AJQ
Windows 7, Arduino 1.6.11, Teensyduino 1.30
Is there anything I can do to stabilize these readings? Is it possible to get steady values from this setup and resolution or am I asking too much? Any ideas or tips would be greatly appreciated. Thanks!
PHP:
const int SpeedPotPin = 18;
int SpeedPot = 0;
void setup(){
Serial.begin(9600);
while(!Serial);
pinMode(SpeedPotPin, INPUT);
analogReadResolution(12);
analogReadAveraging(32);
}
void loop(){
SpeedPot = analogRead(SpeedPotPin);
Serial.print("Speed Pot:");Serial.println(SpeedPot);
delay(100);
}