The sample code of this button module is in the folder “4*4 button experiment”. Firstly, you need to unzip class library file “Keypad.zip” and place it in subfolder “libraries” of folder “Arduino” .
Codes are as below:
#include
const byte ROWS = 4; // define row 4
const byte COLS = 4; // define column 4
char keys[ROWS][COLS] = {
{‘1′,’2′,’3′,’A’},
{‘4′,’5′,’6′,’B’},
{‘7′,’8′,’9′,’C’},
{‘*’,’0′,’#’,’D’}
};
// connect row ports of the button to corresponding IO ports on the board
byte rowPins[ROWS] = {2,3,4,5};
// connect column ports of the button to corresponding IO ports on the board
byte colPins[COLS] = {6,7,8,9};
// call class library performance function of Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
}
void loop(){
char key = keypad.getKey();
if (key != NO_KEY){
Serial.println(key);
}
}

 220uF 50V Aluminum electrolytic capacitor
220uF 50V Aluminum electrolytic capacitor						 SPDT Slide Switch (2xpc)
SPDT Slide Switch (2xpc)						 9V Battery Snap Clip (Wires)
9V Battery Snap Clip (Wires)						

 
				


 
				 
				 
				 
				 
				 
				 
				 
				
Reviews
There are no reviews yet.