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

Thread: T3.5 ADC Readings Just Float

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    13

    T3.5 ADC Readings Just Float

    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 Code:
    
    
    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?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,601
    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".

  3. #3
    Junior Member
    Join Date
    Feb 2018
    Posts
    13
    Yup! That did the trick. Thanks so much!

Posting Permissions

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