Analog pins for keypad

Nub here..
can I use the A0-A15 as digital pins?.. I want to use them for my keypad input to the Arduino?.. currently I use Digital 2-8 for the keypad..I am using the "HelloKeypad" sketch from the Keypad library..

can I use the A0-A15 as digital pins?

Yes.

Do I just call them A1 etc in my rowPins[Rows] = {5, 4, 3, 2}; ?

Should it look like this: rowPins[Rows] = {A5, A4, A3, A2}; ?

I would call them 14 for A0, 15 for A1 and so on.

Great...

Thanks

I would call them 14 for A0, 15 for A1 and so on.

The A0, A1, etc. names are #defined to the correct value (14, 15, etc. on 328-based; 54, 55, etc. on Mega).

The A0, A1, etc. names are #defined to the correct value (14, 15, etc. on 328-based; 54, 55, etc. on Mega).

Yes I know but:-

I would call them 14 for A0, 15 for A1 and so on.

:slight_smile:

Then, try to move that code to a Mega, and it no longer works. A0 refers to the correct pin on both boards (the one physically located in the same place).

Then, try to move that code to a Mega, and it no longer works.

Yes the point is that I would not expect it to. I am a hardware guy after all. :slight_smile:

I actually moved them to digital pins on the Mega..22,24,26,28 for rows and 31,33,35 for Cols.. Works good so far..
Thanks again for the guidance