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

Thread: analogRead() not returning any values

  1. #1

    analogRead() not returning any values

    hello, I am struggling to essentially just return any values with the analogRead() function. I have attached a 10k potentiometer to 3.3v and ground. When I print the values to the console all I see is 7 and 8 streaming in constantly. I was curious if I had a faulty potentiometer so I attached the 3.3v directly into analogPin 14, again with the same results. I will post my code below but it is extremely simple. I am using a teensy 4.1. If anybody has any suggestions I would love to hear them!
    Code:
    void setup() {
    }
    
    void loop() {
      Serial.println(analogRead(A14));
    }

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,982
    Any chance the pot may be connected to the wrong pin? A14 is pin 38, right above the 5 pins that run across the middle of the board.

  3. #3
    Haha well if I've learned anything today it's that I need glasses. Thanks for the help, its up and running!

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,982
    Glad it's working now.

Posting Permissions

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