#include <Keypad.h>
const int led=10;
int sum=0;
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
String number ="";
int hum[10]={40,33,65,45,60,44,55,94,30,90};
bool status[10];
int count=0;
void setup(){
pinMode(led, OUTPUT);
Serial.begin(9600);
for(int i=0;i<10;i++){
status[i]=false;
}
}
void loop(){
char Key = customKeypad.getKey();
if (Key){
number += Key;
if(number.length()==2){
int num=number.toInt();
check(num);
number="";
}}}
void check(int pass) {
for (int i=0;i<10;i++) {
if (pass==hum[i]) {
if (!status[i]) {
status[i]=true;
count++;
Serial.println(pass);
} else {
status[i]=false;
count--;
Serial.println(pass);
}
}
}
if(count==10){
digitalWrite(led, HIGH);
}
else{
digitalWrite(led, LOW);
}
}