I am working on a project on nano and want to use analog pins for 4x4 matrix keypad input. My connections are for keypad are as follows:
- Digital pins are D10-D13 and Analog pins are A0-A3.
- A0->14,
- A1->15,
- A2->16,
- A3->17
Code is:
#include <Keypad.h> // includes the keypad library
const byte ROWS = 4; // four rows
const byte COLS = 4; // four columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {10,11,12,13}; // connect to the row pinouts of the keypad
byte colPins[COLS] = {14,15,16,17}; // connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
Can I use analog pins as I defined for keypad? Is "Keypad.h" library compatible with Arduino Nano v3.0?