Pin labeling on nano

Arduino forum,
Relatively new to Arduino and I'm confused about the pin labeling on a nano.

There are package pin numbers 1-30 but if I want to define a pin for some digital purpose, lets say D7 I #define xxx 7. But there is also another pin 7 on the analog side. How do I distinguish one from the other?

jerdon

  • Show us an image of your Nano.

  • If this, use D? and A? numbers.

1 Like

You refer to the digital pins (D0..D13) pins by their number (0..13).

const byte btnPin = 2;

You refer to the analogue pins (A0..A7) by their 'name'; e.g

const byte potPin = A0;

You can refer to analogue pins by a number but if you ever have to rework your sketch for another board you have to rework the sketch.

const byte potPin = 14;  // A0 on Nano/Uno/ProMini
2 Likes