Bàn Phím Số Ma Trận 4x4, là sản phẩm nhập dữ liệu từ người dùng. Ứng dụng trong lĩnh vực giao tiếp với con người bằng mã PIN, cụ thể là hệ thống access control, hệ thống khóa bảo mật…
Thông số kỹ thuật:
- Độ dài cáp: 88mm.
- Nhiệt độ hoạt động 0 ~ 70oC.
- Đầu nối ra 8 chân.
- Kích thước bàn phím 65 x 64mm
Sơ đồ chân:
Code tham khảo Arduino:
// Thứ tự chân từ trái sang phải 1 2 3 4 5 6 7 8 9 10
/*4X4 Arduin0
* 2 - A0
* 3 - A1
* 4 - A2
* 5 - A3
* 6 - 7
* 7 - 6
* 8 - 5
* 9 - 4
*
*
* Nạp code mở Serial Monitor, chọn No line ending, baud 9600.*/
#include <Keypad.h>const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {7, 6, 5, 4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A0, A1, A2, A3}; //connect to the column pinouts of the keypad//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);void setup(){
Serial.begin(9600);
}
void loop(){
char customKey = customKeypad.getKey();
if (customKey){
Serial.println(customKey);
}
}
Video tham khảo: