// C++ code
//
#include <EEPROM.h>
#include <Keypad.h>
#include  <LIquidCrystal.h>



LiquidCrystal lcd(7,6,5,4,3,2);

const int BARIS = 4;
const int KOLOM = 4;
char tombol[BARIS][KOLOM] = {
  {1,  2,  3, 'A'},
  {4,  5,  6, 'B'},
  {7,  8,  9, 'C'},
  {'*',0, '#','D'}
};

byte pinBaris [BARIS] = {A0,A1,A2,12};
byte pinKolom [KOLOM] = {11,10,9,8};

Keypad keypad = Keypad(makeKeymap(tombol),pinBaris, pinKolom, BARIS,KOLOM);



const int led=13;
bool mode1=true;
bool mode2=false;
long dtTombol=0;



void setup() {
  Serial.begin(9600);
  pinMode(led,OUTPUT);
  digitalWrite(led,LOW);
  lcd.begin(16,2);
  Serial.println(EEPROM.read(0));
  cekKeamanan("User ID", EEPROM.read(0));
  mode1=true;
  cekKeamanan("Password", EEPROM.read(1));
  mode1=true;
  lcd.clear();
  lcd.setCursor(5,0);
  lcd.print("Akses");
  lcd.setCursor(3,1);
  lcd.print("diijinkan");
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Loading.");
  delay(700);
  for(int i=1; i<=5; i++){
    lcd.setCursor(i+7,0);
    lcd.print(".");
    delay(700);
  }
}


void loop() {
  lcd.setCursor(0,0);
  lcd.print("Anda berada di");
  lcd.setCursor(0,1);
  lcd.print("dalam system...");
  char key=keypad.getKey();
  if(key){
    if(key=='A'){
      digitalWrite(led,LOW);
      cekKeamanan("Password lama :", EEPROM.read(1));
      mode1=true;
      mode2=true;
      cekKeamanan("Password baru :", EEPROM.read(1));
      mode2=false;
      mode1=true;
    }
  }
  digitalWrite(led,HIGH);

}



void cekKeamanan(String str, byte data){
  lcd.clear();
  dtTombol=0;
  lcd.setCursor(0,0);
  lcd.print(str);
  while(mode1){
    char key = keypad.getKey();
    if(key){
      if(key == 'D'){
        if(mode2){
          EEPROM.write(1,dtTombol);
          lcd.setCursor(0,0);
          lcd.print("Password          ");
          lcd.setCursor(0,1);
          lcd.print("diperbaharui");
          for(int i=1; i<=3; i++){
            lcd.setCursor(i+11,1);
            lcd.print(".");
            delay(700);
          }
          mode1=false;
        }
        if(!mode2){
          if(dtTombol==data){
            mode1=false;
          }else{
            lcd.setCursor(0,1);
            lcd.print("     invalid");
            delay(1500);
            cekKeamanan(str,data);
          }
        }
      }else{
        if(key!='A' && key!='B' && key!='C' && key!='#'){
          if(key=='*'){
            dtTombol=(dtTombol-dtTombol%10)/10;
            lcd.setCursor(0,1);
            lcd.print("                 ");
          }else{
            dtTombol=dtTombol*10+key;
          }
          lcd.setCursor(0,0);
          lcd.print(str);
          lcd.setCursor(0,1);
          lcd.print(dtTombol);
        }    
      }    
    }
  }
}

Link library Keypad

Source : Youtube Life Tech