Codey OnlineBibliothèque de composants Arduino & ESP32 › Keypad 4x3
Keypad 4x3
Entrée & boutons

Keypad 4x3

Matrice de clavier 4x3 123 456 789 *0#

Largeur: 48.7 mm

Brochage — Keypad 4x3

Broche 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

Exemple de schéma de câblage — Keypad 4x3

De Vers Fil
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

Exemple de code Arduino — Keypad 4x3

Cet exemple a été écrit et vérifié à la compilation pour le arduino-uno. Codey Online l'adapte pour vous à toute autre carte prise en charge.

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

Composants similaires

Drukknop

Drukknop

HX711 Load Cell Amplifier

HX711 Load Cell Amplifier

Tactile switch

Tactile switch

Construisez votre projet Arduino ou ESP32 avec l'IA

Décrivez ce que vous voulez créer. Codey Online écrit le code, dessine le schéma de câblage, le compile et flashe votre carte directement depuis le navigateur.

Commencez gratuitement