3x4 Matrix Keypad: 두 판 사이의 차이
잔글편집 요약 없음 |
잔글편집 요약 없음 |
||
| 1번째 줄: | 1번째 줄: | ||
{{#seo:|title= | {{#seo:|title=ArduWiki : Arduino 3x4 Keypad Guide|title_mode=append|keywords=Arduino, Computer Science, Maker Learning, Performance Assessment, 3x4 Keypad, Arduino Project, Capstone Project, Arduino Example Code|description=Introduces how to control a 3x4 keypad using Arduino (basic info, wiring, example code). Useful for computer science and maker classes.}} | ||
[[File:3X4키패드대표이미지.jpg|center|class=coders100]] | [[File:3X4키패드대표이미지.jpg|center|class=coders100]] | ||
It's a 3x4 numeric type keypad. The far-left and far-right pins are not used, leaving pins 1 to 7, starting from the left, for use. | It's a 3x4 numeric type keypad. The far-left and far-right pins are not used, leaving pins 1 to 7, starting from the left, for use. | ||
2025년 3월 27일 (목) 15:21 기준 최신판

It's a 3x4 numeric type keypad. The far-left and far-right pins are not used, leaving pins 1 to 7, starting from the left, for use.
You can check the pin numbers in the image provided.
[For example, pressing '1' on the keypad will output signals from pins 3 and 2.]
Specifications
- Operating Voltage: 3 ~ 5V
- Resistance: 10 ~ 150 ohms
Example Required Hardware
- Arduino board
- Jumper cables
- 3x4 keypad
Library
- Keypad by Mark Stanley, Alexander Brevig (installable via the Library Manager)
- Please refer to the Arduino library link for instructions on how to use the library.
Connection
| keypad | Arduino | |||
| 1 | D7 | |||
| 2 | D5 | |||
| 3 | D8 | |||
| 4 | D2 | |||
| 5 | D6 | |||
| 6 | D3 | |||
| 7 | D4 | |||

example code
This code outputs to the serial monitor when a key on the keypad is pressed.
#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] = { 5, 4, 3, 2 };
byte colPins[COLS] = { 8, 7, 6 };
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin(9600);
Serial.println("Serial start");
}
void loop(){
char key = keypad.getKey();
if(key != NO_KEY){
Serial.print(key);
}
}
Execution Result
