How can I get analog inputs A15-A17 working on a Teensy 3.2 (pins 25-27)

Status
Not open for further replies.

glasspusher

Active member
possibly noob question. A0-13 work fine, I need a few more. I've been trying to init pins 25-27 for A15-17. Do I need to do something else?

Looked around, did not find an answer to this.

pinMode(A13, INPUT); // this works just fine

pinMode(A15, INPUT); //pin 26
pinMode(A16, INPUT); //pin 27
pinMode(A17, INPUT); //pin 28

Any and all, much appreciated.
 
pinMode is for digital pins to use GPIO functionality, that means if you want to use a pin which can either be digital or analog as a digital pin.

"Pure" analog pins without GPIO don't need to be configured with pinMode(), these can be read directly with analogRead()
 
Last edited:
Thanks for the reply. Figured it out- turns out A0-A13 translate to 0 to 13. The constant A14 has the value 40, the constant A15 has the value 26. When I was reading them I assumed I could just read them sequentially 0-15, but this is not the case. I was doing

for(i = 0; i < 16; ++i)
foo = analogRead(i);

but that didn't work for Ax above x = 13.

Thanks for making me think!
 
Status
Not open for further replies.
Back
Top