Teensy 2.0++ not reading analog in from potentiometer.

Status
Not open for further replies.

Dafyddct

Member
Hey Guys, this is my first post.

I recently bought a Teensy 2.0++ and an Arduino Uno.

Iv'e managed well with programming and haven't any issues so far however I'm
struggling to read analog in signals from a 50k potentiometer.
Iv'e used the same code for the Arduino Uno and works perfectly.

To my understanding the left pin goes to the +5v pin on the breadboard, the middle
pin goes to the analog input pin on the Teensy and the right pin goes to the ground on the breadboard.
And before anyone asks, yes Ive wired the +5v and the GND to the appropriate pins on the breadboard.

Thanks in advance to anyone who comments, Dafydd.

This is the code i used just to test the pot:

Code:
int pot = 45;

void setup(){
  Serial.begin(9600);
  pinMode(pot, INPUT);
}
void loop(){
  int potValue = analogRead(pot);
  Serial.println(potValue);
}
 
To amplify on the above...
A5 is elsewhere defined as a symbolic constant named A5 (starts with a letter).
Below is a more common use

Code:
#define POTPIN A5

void setup(){
  Serial.begin(9600);
  pinMode(POTPIN , INPUT);
}
void loop(){
  int potValue;
  potValue = analogRead(POTPIN );
  Serial.println(potValue);  
  delay(500);
}
 
Last edited:
Thanks for the reply, directly inserted your code and no luck, I'm beginning to assume that there's a fault with the pot. Many Thanks.
 
Have a volt meter? If so, connect it to the arm of the pot and other lead to ground. Disconnect from teensy. Twist pot. Watch meter.
 
I know you connected the voltage and ground but I struggled with a pot for a long time because I didn't realize those lines only run halfway down the breadboard unless you stick jumpers on them.
 
Status
Not open for further replies.
Back
Top