Arduino UNO R3 Compatible using CH340T
 

  13.00 JD                     Add to cart

4 x 4 keypad

    3.00 JD                      Add to cart

4x4 Keypad Interface

 Keypad is one of the most common components for human-computer interface. one of the best methods to build a Keypad is to use a matrix keypad we will show how to use a 4 x4 keypad with keypad library Arduino. Matrix keypad has pins for each row and each column. so our 4x4 keypad has 8 pins.

Connection 

Keypad pins 1,2,3 and 4 present the rows of the key pad and the are connected to digital pins 2,3,4, and 5 while the ther pins presents the columns. 

                *Source: http://learn.linksprite.com/arduino/4x4-keyboard-for-arduino/


 Code 

Download Keypad Libarary 


#
include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;                                                          
 
//define the symbols on the buttons of the keypads
char Keys[ROWS][COLS] =
{
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
 
byte rowPins[ROWS] = {2,3,4,5};
byte colPins[COLS] = {6,7,8,9};
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad(makeKeymap(Keys),rowPins,colPins,ROWS,COLS);
 
void setup()
{
  Serial.begin(9600);
  Serial.println("Please press the keyboard:");
}
 
void  loop()
{
  char key = customKeypad.getKey();
  if(key!=NO_KEY)
  {
    Serial.print("Key Value : ");
    Serial.println(key);
  }
}