//#include const byte numRows = 6; //number of rows const byte numCols = 11; //number of columns const int debounceTime = 100;//20 works better than great ! byte rowPins[numRows] = {A0, A1, A2, A3, A4, A5}; //connect to the row pinouts of the keypad byte colPins[numCols] = {12, 11, 10, 9, 8 ,7, 6, 5, 4 ,3 ,2}; //connect to the column pinouts of the keypad void setup() { Serial.begin(9600); Serial.println("Starting up"); for (int row = 0; row < numRows; row++) { pinMode(rowPins[row],INPUT); // Set row pins as input digitalWrite(rowPins[row],HIGH); // turn on Pull-ups } for (int column = 0; column < numCols; column++) { pinMode(colPins[column],OUTPUT); // Set column pins as outputs for writing digitalWrite(colPins[column],HIGH); // Make all columns inactive } } void loop() { for(int column = 0; column < numCols; column++) { digitalWrite(colPins[column],LOW); // Activate the current column. for(int row = 0; row < numRows; row++) // Scan all rows for a key press { if(digitalRead(rowPins[row]) == LOW) // Is a key pressed? { delay(debounceTime); // debounce while(digitalRead(rowPins[row]) == LOW); // wait for key to be released Serial.print("H: "); Serial.print(row); Serial.print(", "); Serial.print(column); Serial.println(""); delay(1000); } } digitalWrite(colPins[column],HIGH); // De-activate the current column. } }