T3.5 ADC Readings Just Float

Status
Not open for further replies.

Power_Broker

Well-known member
Hey everybody,

I've had a lot of experience with Arduinos (even a little with PIC32s) and decided to give the Teensy 3.5 a try. So far it's amazing, but I can't read any of the analog inputs other than A0-A9, A12, and A13.

Just to clarify: A0-A9, A12, and A13 analog inputs work as expected, but inputs A14-A22 just show floating voltages when trying to read from a pot. It isn't the wiring - just GND and signal (might not be a great idea, but the pot is on an external supply).

Here is the code:
HTML:
void setup()
{
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  
  analogReadResolution(16);
  
  Serial.begin(115200);
}



void loop()
{
  Serial.println(analogRead(22)*(3.3/65535));
}




Is there something I'm missing? Why do some analog inputs work and others don't?
 
Use analogRead(A22).

When you use analogRead(22), it actually tries to read from pin 22, which is A8.

Numbers 0-13 for A0-A13 are supported for compatibility with legacy Arduino (which has 6 or 8 analog inputs), but past 13 the numbers are ambiguous. You need to give it the actual pin number, or the names starting with "A".
 
Status
Not open for further replies.
Back
Top