Main Product 1 Main Product 2 Main Product 3
In Stock
Price: KSH 250.00

Introduction

The 4x4 Keypad module is a matrix keypad with 16 buttons arranged in rows and columns. It is widely used in embedded systems for user input.

Pinout

Pin Description
R1 Row 1
R2 Row 2
R3 Row 3
R4 Row 4
C1 Column 1
C2 Column 2
C3 Column 3
C4 Column 4

Working Principle

The 4x4 keypad operates on a matrix principle, where each button connects a specific row and column. The microcontroller scans the rows and columns to detect which button is pressed.

Example Code

#include 

const byte ROWS = 4; // Number of rows
const byte COLS = 4; // Number of columns

char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

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

Keypad Image

4x4 Keypad Module

🔥RELATED PRODUCTS🔥

🔗 HIMASTORES PRODUCTS