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

Keypad 4x4

Toetsenbord met 4x4 knoppen 123A 456B 789C *0#D

Breedte: 64.5 mm

Pinout — Keypad 4x4

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

Voorbeeld-aansluitschema — Keypad 4x4

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

Voorbeeld-Arduinocode — Keypad 4x4

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

Vergelijkbare componenten

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

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