PROPERLY Addressing Nano Pins in sketches - much confusion

So when it comes to using the right integer numbers inside a sketch for an Arduino Nano, when it comes to addressing the right pins in the code, there seems to be a variety of information out there and none of it is consistent.

For example, this image for the pinouts shows that pin numbers D11, D12 and RESET are actually pin numbers 15, 16 and 29. But this document shows those same pins as 14, 15, and 3.

When I'm defining variables in my sketch (for example):

#define RESET 3
#define pin11 14
#define pin12 .15

How the heck do I know for sure which numbers are literally assigned to each pin on the Nano? I've been having a hell of a time getting a TFT display to work because I just have no way of knowing, which pins I'm actually addressing in the code.

Any enlightenment on this would be much appreciated.

Thank you,

Mike Sims

EasyGoing1:
For example, this image for the pinouts shows that pin numbers D11, D12 and RESET are actually pin numbers 15, 16 and 29.

15, 16, 29 are the physical pins on the ATmega328P microcontroller.

EasyGoing1:
But this document shows those same pins as 14, 15, and 3.

That's the pin number on the PCB, counting counterclockwise from the top left corner.

They're both correct, just referring to different things.

EasyGoing1:
How the heck do I know for sure which numbers are literally assigned to each pin on the Nano?

The Arduino pin numbers are written right there on the silkscreen of the board. Use those numbers in your Arduino code.

pert:
The Arduino pin numbers are written right there on the silkscreen of the board. Use those numbers in your Arduino code.

So if I take that literally, I would define them in my code like this:

#define pin11 . D11
#define pin12 . D12

And I've tried this before, and some pin numbers work this way and some don't ... again ... inconsistencies.

NO!!! that's just crazy pin 11 is 11. Pin 12 is 12. The only time you should use the Dn pin notation is with a WeMos ESP8266 board but you're using a Nano so don't do that.

Why the heck do you have a period in your macro definitions? In fact I recommend that you don't use #define at all.

Use descriptive variable names. pin11 means nothing. If you do something like this:

const byte lcdCSpin = 11;
const byte lcdResetPin = 12;

Then it will be really easy to understand the intent of your code.

Not that literally.

#define pin11 11
#define pin12 12

Here's some fancy code defining pin numbers based on the Arduino model in use.

#if defined(ARDUINO_AVR_UNO)
 #define LED_OUT 13
 #define SENSOR_INPUT_PIN 2
 #define START_STOP_PIN 12
 #define SCROLL_PIN 11
 #define MODE_PIN 10
 #define LBO_PIN 3
 LiquidCrystal lcd(8, 9, 4, 5, 6, 7);           // select the pins used on the LCD panel
 #define Timer1_OCR1A 249
#elif defined(ARDUINO_AVR_PRO)
 #define LED_OUT 13
 #define SENSOR_INPUT_PIN 8
 #define START_STOP_PIN 12
 #define SCROLL_PIN 11
 #define MODE_PIN 10
 #define LBO_PIN 9
 LiquidCrystal lcd(7, 6, 5, 4, 3, 2);           // select the pins used on the LCD panel
 #define Timer1_OCR1A 124
#else
  #error Unsupported board selection.
#endif

It works 100%.

The issue I think your are running into is the Reset pin. It is not coded within the Arduino IDE as a digital input pin. I would first have to ask why you need to detect the reset being pressed and how you will execute any program prior to the hardware reset activating? You will need write custom code in order to see that pin press.

I think the confusion is because the TFT has a reset pin. But that's unrelated to the reset pin on the Nano. You can use any digital pin on the Nano you like connected to the reset pin of the display but you don't connect the reset pin on the display to the reset pin on the Nano.