Hi?, i’ve just started this project, which check the password. If it’s correct write on lcd “success” or if it’s wrong write “wrong”. But when i try to start the project it gives me this error (variable or field ‘checkPassword’ declared void), but i dont know how to fix it. Does anybody know how to fix it?
THE PRJECT
#include <Password.h>
#include <Keypad.h>
#include <LiquidCrystal.h>
Password password = Password( “1918” );
const byte ROWS = 4; //-------------------------- 4 righe
const byte COLS = 4; //-------------------------- 4 colonne
int i=0;
char keys[ROWS][COLS] = { //-------------------------- definisco la mappa del keypad
{‘1’,‘2’,‘3’,‘A’},
{‘4’,‘5’,‘6’,‘B’},
{‘7’,‘8’,‘9’,‘C’},
{’*’,‘0’,’#’,‘D’}
};
LiquidCrystal lcd(50, 52, 47, 49, 51, 53);
byte rowPins[ROWS] = { 2,3,4,5 };
byte colPins[COLS] = {6,7,8,9 };
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
lcd.begin(16, 2);//--------------------------inizializzo il display lcd
Serial.begin(9600);//--------------------------inizializzo il monitor seriale
keypad.addEventListener(keypadEvent); //aggiungi un evento che aspetti una risposta dal keypad
lcd.print(“Password:”);//--------------------------stampo di defaul “password”
}
void loop(){
keypad.getKey();
}
void keypadEvent(KeypadEvent eKey)
{
switch (keypad.getState())//--------------------------aspetto che venga digitato qualcosa sul keypad
{
case PRESSED://--------------------------quando viene premuto qualcosa
lcd.setCursor(i,1);
lcd.print(’*’);
i=i+1;
switch (eKey)//--------------------------controllo ch pulsante è stato prremuto
{
case ‘*’://--------------------------conferma di inserimento password
checkPassword(eKey);
break;
case ‘#’://--------------------------reset per l’inserimento della password
password.reset();
i=0;
break;
default: //--------------------------default
password.append(eKey);
}
}
}
void checkPassword(eKey)//--------------------------controllare se la password è giusta
{
if (password.evaluate())//--------------------------password giusta
{
lcd.clear();
lcd.setCursor(4,0);
lcd.print(“Success”);
switch(eKey)
}
else//--------------------------password sbagliata
{
lcd.clear();
lcd.setCursor(5,0);
lcd.print(“Wrong”);
}
}