#include <Keypad.h>
#include <LiquidCrystal.h>
const int ROW_NUM = 4; // four rows
const int COLUMN_NUM = 4; // four columns
char keys[ROW_NUM][COLUMN_NUM] = {
{'1','2','3', 'A'},
{'4','5','6', 'B'},
{'7','8','9', 'C'},
{'*','0','#', 'D'}
};
byte pin_rows[ROW_NUM] = {10 ,9, 8, 7}; // connect to the row pinouts of the keypad
byte pin_column[COLUMN_NUM] = {6, 5, 4, 3}; // connect to the column pinouts of the keypad
Keypad customKeypad = Keypad(makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );
const int BUZZER_PIN = 12;
void setup () {
Serial.begin(9600);
pinMode(BUZZER_PIN, OUTPUT);
}
void loop () {
// This is just a snippet from "old" code, to be replaced with the
// asked basic task of digits input only, then add sound,...
char customKey = customKeypad.getKey();
if (customKey) {
tone(BUZZER_PIN, 750, 100); // make a beep sound
Serial.print("Enter your PhoneNo.: ");
/*if (customKey != NO_KEY) {
Serial.print(customKey);*/
char PhoneKey = customKeypad.getKey();
if (PhoneKey!= NO_KEY) {
// Initialize if a key is pressed
Serial.print(" = ");Serial.println(PhoneKey);
}
}
}
//}