problem ?n my code

I have this code when the ALARM is HIGH and (ZONE1_State == LOW||ZONE2_State == LOW)
I can’t insert the passwoard .
if ZONE1 AND ZONE2 are HIGH .
I can insert the password why?

const int ZONE1 = 4;     // THE ZONE 1 ON 4 PIN 
const int ZONE2 = 5;     // THE ZONE 2 ON 5 PIN 
const int ALARM = 13;    // THE ALARM  ON 12 PIN

// variables will change:
int ZONE1_State = 1;         // variable for reading the ZONE1 status
int ZONE2_State = 1;         // variable for reading the ZONE2 status
int ON_IN_State = 0 ;        // ON_IN State
int RUN_IN_State = 0 ;       // RUN_IN State





#include <Wire.h>
#include <PCFCrystal.h>
#include <i2ckeypad.h>
#include <Password.h>

Password password = Password( "1234" );

byte buffer = 0;

PCFCrystal lcd(B00100000, B00010000, B00000001, B00000010, B00000100, B00001000, 0x38, &buffer);
const int buttonPin = 2;


#define ROWS 4
#define COLS 4


#define PCF8574_ADDR 0x3F




i2ckeypad kpd = i2ckeypad(PCF8574_ADDR, ROWS, COLS);

#define buzz 0x3B 

void setup() {
  Serial.begin(9600);
  Wire.begin();
  lcd.begin(16, 2);
  lcd.setCursor(0,0);

  // initialize the output:

  pinMode(ALARM, OUTPUT);      
  // initialize the  input:
  pinMode(ZONE1, INPUT);   
  pinMode(ZONE2, INPUT);

  kpd.init();

  Wire.beginTransmission(buzz);
  Wire.send(B00000000);
  Wire.endTransmission();

  Serial.print("Testing keypad/PCF8574 I2C port expander arduino lib\n\n");
}

void loop() {
  // read the state of the pushbutton value:
  ZONE1_State = digitalRead(ZONE1);
  ZONE2_State = digitalRead(ZONE2);

  if (ON_IN_State == HIGH && ZONE1_State == HIGH && ZONE2_State == HIGH ){
    delay(2000);

    /* switch on P0 */
    Wire.beginTransmission(buzz);
    Wire.send(B11111111);
    Wire.endTransmission();
    delay(500);

    /* switch off all pins */
    Wire.beginTransmission(buzz);
    Wire.send(B00000000);
    Wire.endTransmission();
    delay(500);  
    /* switch on P0 */
    Wire.beginTransmission(buzz);
    Wire.send(B11111111);
    Wire.endTransmission();
    delay(500);

    /* switch off all pins */
    Wire.beginTransmission(buzz);
    Wire.send(B00000000);
    Wire.endTransmission();
    delay(500);  

    RUN_IN_State = HIGH;


    lcd.setCursor(0,0);
    lcd.print("ENERGOS MESA                      ");
    lcd.setCursor(0,1);
    lcd.print("                                 ");
    ON_IN_State = LOW;


  }
 

  if (RUN_IN_State == HIGH && (ZONE1_State == LOW||ZONE2_State == LOW) ){
    digitalWrite(ALARM, HIGH);
    RUN_IN_State == LOW;
    lcd.setCursor(0,0);
    lcd.print("ALARM                         ");
    lcd.setCursor(0,1);
    lcd.print("                                 ");
  }



  char key = kpd.get_key();

  if(key) {
    switch (key)
    {
    case 'A':

      (ON_IN_State = HIGH);
      lcd.setCursor(0,0);
      lcd.print("ENERGOPOIHSH                ");
      lcd.setCursor(0,1);
      lcd.print("APO MESA                      ");

      break;
   

      Serial.println(key);
    case '#': 
      guessPassword(); 
      break;
    case '*': 
      password.reset(); 
      break;
    default: 

      password.append(key);



    }
  }
}

void guessPassword(){
  if (password.evaluate()){
    digitalWrite(ALARM, LOW);


    lcd.setCursor(0,0);
    lcd.print("sosto password                     ");
    password.reset(); 

  }

  else{
    lcd.setCursor(0,0);
    lcd.print("lathos password                     ");
  }

}

I'm not sure from your variables which is ALARM. However, if kpd.getkey() returns immediately what does it return? If 0 then it looks as though the switch might always call password.append(). That might make if difficult to enter any real password. (Actually the switch will call the default for any intput that is not A,# or *).

Put some debug around your 3 code blocks so see where you are getting to, or buzz each time you get a key.

I can't understand this .can you explanation what I exactly need i do

enterpc: I can't understand this .can you explanation what I exactly need i do

That:

shelleycat: Put some debug around your 3 code blocks so see where you are getting to, or buzz each time you get a key.

Like this

i2ckeypad setDebounceTime(3); kpd.init();