Codey OnlineArduino- & ESP32-Komponentenbibliothek › Keypad 4x3
Keypad 4x3
Eingabe & Taster

Keypad 4x3

4x3-Tastenfeldmatrix 123 456 789 *0#

Breite: 48.7 mm

Pinbelegung — Keypad 4x3

Pin Signal Beschreibung
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

Beispielschaltplan — Keypad 4x3

Von Nach Kabel
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

Arduino-Beispielcode — Keypad 4x3

Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.

#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);
  }
}

Ähnliche Komponenten

Drukknop

Drukknop

HX711 Load Cell Amplifier

HX711 Load Cell Amplifier

Tactile switch

Tactile switch

Bau dein Arduino- oder ESP32-Projekt mit AI

Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.

Kostenlos starten