Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Cannot find A14-A17 on a Teensy 4.1?

  1. #1

    Cannot find A14-A17 on a Teensy 4.1?

    I'm trying to read a pot on my Teensy 4.1, but it's not working. This is on A17. So I wrote the code below to check all analog inputs, but still get nothing. In fact, I get nothing from A14-A17. However, I do see the random fluctuations of unconnected analog inputs for all four of them. I checked all up & down both sides of the board, and A0-A13 are ok, but not A14-A17.

    This board is relatively new. I bought it a couple months ago, but only just started playing with it this past week. I used my USB microscope to check for physical damage around those pins & traces, but saw nothing obvious.

    What am I missing?

    Code:
    void setup()
    {                
      Serial.begin(38400);
    }
    
    void loop()                     
    {
      Serial.println("----");
      Serial.println(analogRead(0));
      Serial.println(analogRead(1));
      Serial.println(analogRead(2));
      Serial.println(analogRead(3));
      Serial.println(analogRead(4));
      Serial.println(analogRead(5));
      Serial.println(analogRead(6));
      Serial.println(analogRead(7));
      Serial.println(analogRead(8));
      Serial.println(analogRead(9));
      Serial.println(analogRead(10));
      Serial.println(analogRead(11));
      Serial.println(analogRead(12));
      Serial.println(analogRead(13));
      Serial.println(analogRead(14));
      Serial.println(analogRead(15));
      Serial.println(analogRead(16));
      Serial.println(analogRead(17));
      delay(250);
    }

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,084
    Use analogRead(A17), not analogRead(17).

  3. #3
    That worked. Thanks. Why only for A14-A17 and not the others?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,084
    analogRead(13) technically means to try to read voltage on pin 13. But pin 13 is digital only. It don't have analog input capability.

    Very early versions of Arduino used plain numbers 0 to 5, rather than A0 to A5 (those early Arduino boards only had 6 analog inputs).

    For backwards compatibility, we still support using plain numbers. But that only works up to pin 13, because pin 14 is A0.

  5. #5
    Ahhh makes sense. I thought it might be a legacy/compatibility thing after I read your first reply above. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •