0

Keypad

  • Availability: In Stock
  • Product Code: Keypad
  • Product viewed: 256

  • Special price:

    2,900.00RWF

    Old price:

    6,000.00RWF

    You save:

    52%



A keypad is a set of buttons arranged in a block or "pad" which bear digits, symbols or alphabetical letters. Pads mostly containing numbers are called a numeric keypad.


 Install Keypad Library


Picture of Install Keypad Library


This library is available via the Arduino IDE library manager. If you are using a modern IDE (1.6.2 or above), you can simply use the menu:


Sketch->Include Library->Manage Libraries... Then search for Keypad.


Once found, click on its entry and the install button will appear.

 Modifying the Example Sketch


In Example-->Keypad the default sketch "HelloKeypad" is set up for a 4 x 3 matrix.


Here is the modified code for the 4 x 4 Keypad:


#include <Keypad.h>

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] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
   Serial.begin(9600);
}
  
void loop(){
  char key = keypad.getKey();
  
  if (key){
    Serial.println(key);
  }
}


 Connecting the Arduino to the Keypad


Picture of Connecting the Arduino to the Keypad


Using the diagram above as a reference the leftmost pin is pin 8 on the keypad and the rightmost is pin 1.


Pins 8, 7, 6, 5 on the keypad should be connected to digital pins 5, 4, 3, 2 on the Arduino respectively.


Pins 4, 3, 2, 1 on the keypad should be connected to digital pins 9, 8, 7, 6 on the Arduino respectively.


byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad


  Testing


Picture of Testing


Upload the sketch to your Arduino and open the Serial Monitor.


The pressed keys should be displayed as in the window above.


 Going Further


In Examples-->Keypad there are several examples. All the example sketches can be made to function with the 4 x 4 matrix by changing the following lines of code:


const byte ROWS = 4; //four rows<br>const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad




Write a review

Note: HTML is not translated!
    Bad           Good

FAQ - Frequently Asked Questions

In case you want to change something on your order, login into your account , then you can do any modification you want.
In case you have placed an order passing through your account, the order confirmation will be sent to the email used while creating your account .
In normal condition , the order will be shipped in three working days.
Actually we don't accept products to be returned in case you pick them from our store as they have to be tested in front of you. However,in case you bought online, return will done considering our return policy .
If you don't receive a response to your email , kindly contact us directly to our hotline.
Good , sometime it may be difficult to use a product bought from us. You can visit our Youtube channel :https://www.youtube.com/channel/UCuWIO7nMO3B1cd9QxbBHCww. you may find a tutorial about that product or you can directly contact us.