AED 26.25
Description
Numeric keypads like Keypad 4 X 3 Matrix Array Keyboard 12 Key Membrane Switches can provide a simple end-user alternative for various interfaces for your projects. Or if you need a lot of buttons, they can save you a lot of time with regards to construction.
Specifications:
Number of keys |
12 |
Mechanical durability |
1000000 cycles |
Max. contact resistance: |
200mΩ |
Material |
plastic |
Max. operating voltage |
24V DC |
Switching torque |
1N |
Keystroke |
1.2mm |
Operating current max. |
20mA |
Width |
51mm |
Keypad type |
numeric |
Height |
64mm |
Operating temperature |
-20...60°C |
Keypad color |
BLACK |
We’ll use the small black keypad, an Arduino Uno-compatible, and an LCD with an I2C interface for display purposes. If you don’t have an LCD you could always send the text to the serial monitor instead.
- Keypad row 1 to Arduino digital 5
- Keypad row 2 to Arduino digital 4
- Keypad row 3 to Arduino digital 3
- Keypad row 4 to Arduino digital 2
- Keypad column 1 to Arduino digital 8
- Keypad column 2 to Arduino digital 7
- Keypad column 3 to Arduino digital 6
If your keypad is different to ours, take note of the lines in the sketch from:
// keypad type definition
As you need to change the numbers in the arrays rowPins[ROWS] and colPins[COLS]. You enter the digital pin numbers connected to the rows and columns of the keypad respectively.
Furthermore, the array keys store the values displayed in the LCD when a particular button is pressed.
We’ll run through connecting them, using the Arduino library, and then finish with a useful example sketch.
Connecting 4x3 Keypad with Arduino:
To download Keypad Library for Arduino Click Here:
Arduino Code For Keypad 4 X 3 Matrix Array 12 Key Black to Print the key pressed on The Serial Monitor:
#includeconst byte ROWS = 4; //four rows const byte COLS = 3; //three columns char keys[ROWS][COLS] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'}, {'*','0','#'} }; byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad byte colPins[COLS] = {5, 4, 3}; //connect to the column pinouts of the keypad //Create an object of keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); void setup(){ Serial.begin(9600); } void loop(){ char key = keypad.getKey();// Read the key // Print if key pressed if (key){ Serial.print("Key Pressed : "); Serial.println(key); } }