Danh sách sản phẩm

Bàn phím mềm 1x4 keypad

Mã sản phẩm: IMA532   |   Tình trạng: Còn 31 sản phẩm có sẵn
12.000₫
  • Nhập IMA-90 giảm 90%, tối đa 2K
  • Nhập IMA-5K giảm 5k, đơn từ 199K
  • Nhập IMA-35K giảm 35k, đơn từ 499K

Mô tả sản phẩm

Bàn Phím Mềm 1x4 Phím có thiết kế nhỏ gọn, dễ kết nối và sử dụng, bàn phím có 1 chân chung để nối VCC hoặc GND, các chân còn lại sẽ xuất tín hiệu tương ứng với chân chung này khi có thao tác nhấn phím, phù hợp cho các ứng dụng điều khiển bằng phím bấm.

Thông số kỹ thuật:

  • Số phím: 4 phím.
  • Kích thước: 20 x 70mm
  • Chiều dài cáp: 87mm

Sơ đồ chân:


Code tham khảo Arduino: 

/* 
    1x4     Arduino
      1 -   2
      2 -   3
      3 -   4
      4 -   5
      5 -   6

Nạp code mở Serial Monitor, chọn No line ending, baud 9600
*/

#include "Keypad.h"

const byte Rows= 1; //number of rows on the keypad i.e. 4
const byte Cols= 4; //number of columns on the keypad i,e, 3

//we will definne the key map as on the key pad:

char keymap[Rows][Cols]=
{
{'3', '4', '1','2'}

};

byte rPins[Rows]= {2}; //Rows 0 to 3
byte cPins[Cols]= {3,4,5,6}; //Columns 0 to 2

Keypad kpd= Keypad(makeKeymap(keymap), rPins, cPins, Rows, Cols);

void setup()
{
     Serial.begin(9600);  // initializing serail monitor
}

//If key is pressed, this key is stored in 'keypressed' variable
//If key is not equal to 'NO_KEY', then this key is printed out
void loop()
{
     char keypressed = kpd.getKey();
     if (keypressed != NO_KEY)
     { 
          Serial.println(keypressed);
     }
}

Video tham khảo:

Khách hàng nhận xét