As you go around the UNO board it is obvious that the digital I/O (Do to D13) is number 0 to 13 when using the DATA I/O in the software. What do you use for all the rest of the pins, like the Analog Inputs A0 to A5 and all the other pins on the board?
Do you just use A4, for example or ????? Are the pins just labels and not integer numbers?? I see nowhere in any documentation I have reviewed where this is clearly spelled out. I most certainly could have missed it as a newby to this board.
As in the examples A0-4 (A0-5?) are the analog inputs. The other pins are things like power so that should be obvious, and the AREF pin, but that's for another day.
LDBennett:
As you go around the UNO board it is obvious that the digital I/O (Do to D13) is number 0 to 13 when using the DATA I/O in the software. What do you use for all the rest of the pins, like the Analog Inputs A0 to A5 and all the other pins on the board?
Do you just use A4, for example or ????? Are the pins just labels and not integer numbers?? I see nowhere in any documentation I have reviewed where this is clearly spelled out. I most certainly could have missed it as a newby to this board.
LDBennett
The Arduino.h (or WProgram.h in older versions) that is included by the IDE defines constants for A0, A1, A2, A3, A4, etc. that are appropriate for the machine you are compiling for. Version 1.0 defines:
xl97:
you can also refer to the analog pins as digital pins..
also target them as:
pinMode(14, INPUT);
digitalWrite(14, HIGH);.
etc
etc
IIRC, that works for the standard UNO A0-A5 pins. I believe some of the higher analog input pins on some platforms don't work as digital pins.
Note, you do not want to use 14. You want to use A0, otherwise if you swap your UNO for a Leonardo it won't work as A0 is 18 on Leonardo. Similarly on the Mega, A0 is 54. Use A0..An that Arduino.h (or WProgram.h) provides.