need help in this code please

this code working until when i pressed ‘B’ the program transfer to another loop void dot(); but don’t excut all the loop it just excut this order ( lcd.clear():wink:
i want to what is wrong in this code please

thnxxx

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

Password password = Password( “123” ); //This is our password
LiquidCrystal lcd(38, 40, 42, 44, 46, 48);

const byte ROWS = 4;
const byte COLS = 4;
// Define the Keymap

char keys[ROWS][COLS] = {
{‘1’,‘2’,‘3’,‘A’},
{‘4’,‘5’,‘6’,‘B’},
{‘7’,‘8’,‘9’,‘C’},
{’*’,‘0’,’#’,‘D’}
};

byte rowPins[ROWS] = {22, 24, 26, 28};// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = {30, 32, 34, 36};// Connect keypad COL0, COL1 and COL2 to these Arduino pins.

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
char x;
char y;
int c1=0;
int c=0;
int e1;
int e2;
int e3;
int p1=‘1’;
int p2=‘2’;
int p3=‘3’;
void setup(){
lcd.begin(2,16);
pinMode(50,OUTPUT);

}

void loop(){
x=keypad.getKey();
if(c1==0){ lcd.setCursor(5,0);
lcd.print(“Wellcome”);

lcd.setCursor(0,1);
lcd.write(" press A to Start ");}
if (x==‘A’){
c1=1;
lcd.clear();
lcd.setCursor(0,0);
lcd.write(“B.take”);
lcd.setCursor(10,0);
lcd.write(“C.park”);}
if(x==‘B’){
lcd.clear();
lcd.print(“amr”);
delay(1000);
dot();

}}

void dot(){
lcd.clear();
x=keypad.getKey();
if(x){

lcd.clear();
delay(50);
lcd.print(x);
if (c==0){e1=x;c=1;}
else if (c==1){e2=x;c=2;}
else if(c==2){e3=x; c=3;}

delay(50);}
if (c==3){
if(p1==e1&&p2==e2&&p3==e3){
lcd.clear();
lcd.print(“correct”);
digitalWrite(50,1);
delay(1000);
digitalWrite(50,0);
lcd.clear();
c=0;}
else{lcd.clear();
lcd.print(“Wrong”);
delay(1000);
c=0;
lcd.clear();}
}}

i want to what is wrong in this code please

You mean apart from the shocking formatting and missing code tags?

What is the value of x after this statement ?

  x=keypad.getKey();

Output it to the serial monitor.

What is the value of x after this statement ?

Here's a hint: 99.999% of the time, it will be NO_KEY.

getKey() does not block waiting for you to press a key.

Stop giving the game away !
I was hoping that he would print the value and that the penny would drop.

Stop giving the game away !

Oops. Sorry. :zipper_mouth_face: