Codey OnlineArduino & ESP32 component library › Keypad 4x3
Keypad 4x3
Input & buttons

Keypad 4x3

Keypad 4x3 matrix 123 456 789 *0#

Width: 48.7 mm

Pinout — Keypad 4x3

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

Example wiring diagram — Keypad 4x3

From To Wire
board:D2 x1:R1 green
board:D3 x1:R2 blue
board:D4 x1:R3 yellow
board:D5 x1:R4 purple
board:D6 x1:C1 cyan
board:D7 x1:C2 magenta
board:D8 x1:C3 brown

Example Arduino code — Keypad 4x3

This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.

#include <Keypad.h>

const byte ROWS = 4;
const byte COLS = 3;

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

byte rowPins[ROWS] = {2, 3, 4, 5};
byte colPins[COLS] = {6, 7, 8};

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

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
  Serial.println("4x3 keypad ready. Press a key:");
}

void loop() {
  char key = keypad.getKey();
  if (key) {
    Serial.print("Key pressed: ");
    Serial.println(key);
  }
}

Related components

Drukknop

Drukknop

HX711 Load Cell Amplifier

HX711 Load Cell Amplifier

Tactile switch

Tactile switch

Build your Arduino or ESP32 project with AI

Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.

Start for free