Hi all,
im currently doing a password lock project, im having some issues with the code while entering the password, it gives me "invalid password" regardless of the password being right or wrong, anyway here is the code below, any help will be greatly appreciated
Thanks...
#include <Keypad.h>
#include <Password.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
 {'1','2','3'},
 {'4','5','6'},
 {'7','8','9'},
 {'*','0','#'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 9, 8, 7, 6 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 12, 11, 10 };
// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
Password password = Password("1234");
#define ledPin 13
void setup(){
 pinMode(ledPin, OUTPUT);   // sets the digital pin as output
 digitalWrite(ledPin, HIGH); // sets the LED on
 Serial.begin(9600);
 keypad.addEventListener(keypadEvent); //add an event listener
 keypad.setDebounceTime(250);
}
Â
void loop(){
 keypad.getKey();
}
//take care of some special events
void keypadEvent(KeypadEvent eKey){
 switch (eKey){
  case '*': tryPassword(); break;
  case '#': password.reset(); break;
 default: password.append(eKey);
 }
}
void tryPassword(){
  Serial.print("Guessing password... ");
  if (password.evaluate()){  Â
Serial.println("VALID PASSWORD "); //
       password.reset(); //resets password after correct entry
  }else{
Serial.println("INVALID PASSWORD ");
    password.reset(); //resets password after INCORRECT entry
  }
}