Codey OnlineArduino- & ESP32-Komponentenbibliothek › Keypad 4x4
Keypad 4x4
Sensoren

Keypad 4x4

Tastenfeld mit 4x4 Tasten 123A 456B 789C *0#D

Breite: 64.5 mm

Pinbelegung — Keypad 4x4

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

Beispielschaltplan — Keypad 4x4

Von Nach Kabel
board:D9 x1:C1 green
board:D8 x1:C2 blue
board:D7 x1:C3 yellow
board:D6 x1:C4 purple
board:D5 x1:R1 cyan
board:D4 x1:R2 magenta
board:D3 x1:R3 brown
board:D2 x1:R4 pink

Arduino-Beispielcode — Keypad 4x4

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 = 4;

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};
byte colPins[COLS] = {9, 8, 7, 6};

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

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
  Serial.println("4x4 Keypad example");
  Serial.println("Press a key on the keypad to see it in the Serial Monitor.");
}

void loop() {
  char key = keypad.getKey();

  if (key) {
    Serial.print("Key pressed: ");
    Serial.println(key);
  }
}

Ähnliche Komponenten

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

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