Pin Nomenclature?

Hello All,

(Arduino Newbie)

I have a question regarding designating pin outs on the Nana Every.

Do I specify D2-D21?
Or in the case of the Analog pins do I designate them as A0-A7 even though they would be D14-D21?

Would it be that I use the pin number without the D, so in the case of Pin D7, I would just call
Pin = 7? If it is a analog pin such as pin D20, would I call it Pin = 20, or Pin = A6?
Do I assume on pins A0-A7 I might only call them as Ax pins if using them for Analog IO, and just default to 14-21 if using them as digital IO?

Example from examples
First example from AnalogInOutSerial

const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

This example from WhileStatementConditional

const int sensorPin = A0;       // pin that the sensor is attached to
const int ledPin = 9;           // pin that the LED is attached to
const int indicatorLedPin = 13; // pin that the built-in LED is attached to
const int buttonPin = 2;        // pin that the button is attached to

I apologize for the confusion, I have been previously using a Pi Pico and they use GPIO schema and you just call it by the GP Pin number, so GP0-GP28 is simply Pin 0-28.

Thanks,
Robert

1 Like

You should leave off the "D" prefix. Only use the integer part of the label you see on the board.

You can use either (e.g., digitalRead(A0) or digitalRead(14)), but I recommend following what is written on the board. For me, that is the less confusing thing.

Note that in this case you must leave the "A" prefix. I know that's inconsistent from the digital pins, but this is the system that was established.

You can use the "An" pin number in either context. The code might make things more clear:

Ok, so In my code going forward I will refer to A0-A7 as such.

#define PIN_A3 // D17

On the digital IO side, pins D2-D12 will simply be referred to as Pin 2-12

#define PIN_5 // D5

So essentially one side of the board is Analog IO and the other is Digital IO, Got It :+1:t4:

Thank You for clarifying. I am appreciative of the quick response and advice on the forums.

Robert

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.