Codey OnlineArduino- & ESP32-componentenbibliotheek › Keypad 4x3
Keypad 4x3
Input & knoppen

Keypad 4x3

Keypad 4x3 matrix 123 456 789 *0#

Breedte: 48.7 mm

Pinout — Keypad 4x3

Pin Signaal Beschrijving
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

Voorbeeld-aansluitschema — Keypad 4x3

Van Naar Draad
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

Voorbeeld-Arduinocode — Keypad 4x3

Dit voorbeeld is geschreven en compile-gecheckt voor de arduino-uno. Codey Online past het voor je aan naar elk ander ondersteund board.

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

Vergelijkbare componenten

Drukknop

Drukknop

HX711 Load Cell Amplifier

HX711 Load Cell Amplifier

Tactile switch

Tactile switch

Bouw je Arduino- of ESP32-project met AI

Beschrijf wat je wilt bouwen. Codey Online schrijft de code, tekent het aansluitschema, compileert het en flasht je board rechtstreeks vanuit de browser.

Gratis starten