Toubles on analogRead() on Teensy 4.1

Hello,

I've been working on teensy 4.1 for a year now and recently came into mind blowing troubles.

I have two teensy board that cannot read anologRead() anymore.
I started over with the basic tutorial as I was very confused, and it worked well until the analogInput() sketch. So it looks like it can digitalWrite(), digitalRead(), and analogWrite() but no more analogRead(). The input value is ever 8-12 or 1010-1014 and does not react to anything, even my fingers (which I used to use to make the value move a bit).
The audioBoard still works well with the ladder filter swipping in standalone mode.
The problem is very recent and occured on a first teensy 4.1, so I took one new as I thought I would have done something wrong with the previous one, but both do the same. I have tried a few previous settings of pinMode() also... I doubt you can reproduce this at home but if you have any clue on that ?

Code:
int pin = 11;
int ledPin = 13;

void setup()
{                
  Serial.begin(38400);
  
  pinMode(ledPin, OUTPUT);
  //pinMode(pin, INPUT_PULLUP);
  //digitalWrite(pin, HIGH);
}

void loop()         
{
  delay(100);

  Serial.println("analog "+String(pin) + " is " + analogRead(pin) );

  digitalWrite(ledPin, !digitalRead(ledPin));  
}
IMG_20210417_234413_1.jpg IMG_20210417_234326.jpg



By the way, after spending hours trying to understand why I had a gap in analogRead() from around 495 to 550, even with averaging and precision settings, I found out that using digitalWrite(LOW) on the pin would resolve that (Thanks to the ResponsiveAnalogRead library which is definitly what we should use).

Thanks a lot.
 
The analog pins for the T4.1 are 14--27 and 38-41 according to the info card with the pinouts. You are using
pin 11 which is digital only.
 
Thanks a lot for your quick answer, what a stupid error of mine ! (I actually made a custom document out of teensy connections card fort my pinouts, which was hidding analog infos...)
I should have asked before...
Thanks anyway for the help and reactivity, maybe this thread could be deleted...
 
Back
Top