//keypad interfacing
#include <Keypad.h>
const byte r=4;
const byte c=4;
char data[r][c]={
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowpin[r]={2,3,4,5};
byte colpin[c]={13,12,11,10};
Keypad customKeypad = Keypad( makeKeymap(data), rowpin, colpin, r, c);
void setup() {
pinMode(9, OUTPUT);
Serial.begin(9600);
}
void loop() {
char customKey = customKeypad.getKey();
if (customKey){
Serial.println(customKey);
}
if(customKey=='A')
{
digitalWrite(9,HIGH);
}
if (customKey=='B')
{
digitalWrite(9,LOW);
}
}