#include const byte ROWS = 2; //four rows const byte COLS = 2; //three columns char keys[ROWS][COLS] = { {'a','b'}, {'c','d'}, }; byte rowPins[ROWS] = {16,17}; //connect to the row pinouts of the kpd byte colPins[COLS] = {18, 2}; //connect to the column pinouts of the kpd Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); unsigned long loopCount; unsigned long startTime; String msg; void setup() { Serial.begin(9600); loopCount = 0; startTime = millis(); msg = ""; } void loop() { loopCount++; if ( (millis()-startTime)>5000 ) { Serial.print("Average loops per second = "); Serial.println(loopCount/5); startTime = millis(); loopCount = 0; } // Fills kpd.key[ ] array with up-to 10 active keys. // Returns true if there are ANY active keys. if (kpd.getKeys()) { for (int i=0; i