noobie question on Pots and Analog

Status
Not open for further replies.
i'm trying to understand how to use the analog pins with the teensy...i'm pretty new to arduino and teensy so pardon the stupid question. when you declare variables do you call the analog pins A0-A9 or do you call them 14-23? i've been trying to get some potentiometers wired up for a joystick setup for using in a flight sim, but no matter how hard i try to get them to serial print i can't get any values.

i've been using the basic arduino analog serial read example to try to get any output but to no avail. when i tried with my uno i was able to get it to work.

tried the below and tried it with A0 with no success. thoughts?

void setup() {

Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(14);
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
 
i wired middle to the analog pin A0 (14) and one of the poles to ground and the other to the 3.3volt. my understanding is that it doesn't matter which pole you wire to power and which to ground (just reverses the polarity of the pot) is that wrong?

i don't know if it matters but i have an LC
 
Last edited:
If that's your code above you need to add a pinMode(0,INPUT);

Teensy3/LC start with pins disabled, unlike classic Arduino that start with them as an input. Your pot wiring is fine though can matter which way round it is if you have a log pot rather than a linear one since it will change which way round your slope runs.
 
If that's your code above you need to add a pinMode(0,INPUT);

Teensy3/LC start with pins disabled, unlike classic Arduino that start with them as an input. Your pot wiring is fine though can matter which way round it is if you have a log pot rather than a linear one since it will change which way round your slope runs.

GremlinWrangler to the rescue again.

one last question...i'm unclear whether i should refer to the analog pins by the A#, the A# without the A or the pin number printed on the board. i've tried all combinations and am still not getting anything to show in the serial monitor...i'm sure it's a dumb rookie mistake that i'm leaving something simple out of the code, but i'm just at a loss...
 
Last edited:
thanks. i appreciate it. now to get it to work...i'm just amazed i'm having so much trouble with this thing when i can get my uno to work no problem.

edit: i was having trouble getting my joystick code to work but now it is working great. oddly enough the joystick wasn't detecting properly and i had to nuke a bunch of registry entries to get it to reinstall. now my pots are working correctly. thanks for the help everyone.
 
Last edited:
Status
Not open for further replies.
Back
Top