pin indexes? (Nano)

Maybe I'm the only one and I'm blind, but I can't find a page which illustrates which pin index is which pin on the Arduino Nano. The analog index and digital index is drawn on the bord itself, but not the "global" index.

Always use the names that are printed on the board. Except the digital pins D0-D13 can be called by just their number without the prefix “D”.

const int InputPinStartButon = 3;  //connect the start button to D3
const int AnalogVolumeKnob = A1;  //volume knob wiper connected to A1
  if(digitalRead(InputPinStartButton) && analogRead(AnalogVolumeKnob)>0) {

What do you mean “global”?

MorganS: What do you mean "global"?

Sorry, I meant analog1 and digital1 can't both be 1 "globally", and by this I mean when accessing the pin by it's index (which is not digital index or analog index, but just the index).

Sorry, I meant analog1 and digital1 can't both be 1 "globally

Why not? They are separate pins on the opposite side of the board.

Your question makes little sense. What "index" are you talking about? Typically, index is the name of a variable that accesses the nth element of an array.

I meant analog1 and digital1 can't both be 1 "globally",




read different pins but it can be confusing, hence the use of


to prevent confusion.

The nano uses a 328P chip just like the UNO. The pin numberings should be the same for it as they are for the UNO.

I think what the OP is looking for is where the constants A0 - A5 are defined.

What you want to do is go into the folder where you installed the IDE. Look for the path, Arduino\hardware\arduino\variants

and choose the variant you are looking for. In that folder will be a file called pins_arduino.h It will have a section like this in it.

static const uint8_t A0 = 14;
static const uint8_t A1 = 15;
static const uint8_t A2 = 16;
static const uint8_t A3 = 17;
static const uint8_t A4 = 18;
static const uint8_t A5 = 19;
static const uint8_t A6 = 20;
static const uint8_t A7 = 21;

Is that what you are looking for?

analogRead() can take either the A... constants (which are defined as numbers, counting up from where the last digital pin was), or the number of the ADC channel to read.

Typically, it's recommended to use the A... constants, as those both make it clear to you and someone reading your code what pin you're referring to, and will work as expected with digitalRead()/digitalWrite() and analogRead().

If you google for Arduino Nano Pinout (or whatever arduino board you want) you can find some lovely diagrams.