Need help on code for keypad password authenticating ... PLS HELP

i got problem where i need to evaluate password, if password is typed thrice wrong. an alarm must be trigged…
below is my code… pls help.


#include <Password.h> //
#include <Keypad.h> //

Password password = Password( "65B9" );

#define AlarmWrong 10
const byte ROWS = 4; // Four rows
const byte COLS = 4; //  columns
// Define the Keymap
char keys[ROWS][COLS] = {

byte rowPins[ROWS] = {
32,31,30,29 };     //connect to the row pinouts of the keypad
byte colPins[COLS] = {
 25,26,27,28};     //connect to the column pinouts of the keypad

// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
pinMode(AlarmWrong, OUTPUT);
 keypad.addEventListener(keypadEvent); //add an event listener for this keypad

void loop(){


//take care of some special events
void keypadEvent(KeypadEvent eKey){
 switch (keypad.getState()){
   case PRESSED:
Serial.print("Pressed: ");
switch (eKey){
 case 'A': checkPassword(); break;
 case '3': password.reset(); break;
 default: password.append(eKey);
void checkPassword(){
int x =0;
 if (password.evaluate()){
   //Add code to run if it works
else {


void alarm(){
 Serial.print("trigger alarm");
int x=0;



Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the “Code” icon above the posting area. It is the first icon, with the symbol: </>

Please use code tags.

Read this before posting a programming question

How to use this forum


below is my code.. pls help.

What happens? What do you expect to happen?