0

i am doing this project where i want to put a keypad and take in password from a user and then open the door or not. i used C but every time i call the keypad function in my code the code will not continue. pls help me

void keypad()
{
 int i,j;
 int x=0,k=0;
 delay(2000);
 while(k<4)
 { 
 for(i=0;i<4;i++)
 {
 digitalWrite(col[i], LOW);
 for(j=0;j<4;j++) 
 {
 if(digitalRead(row[j])==0)
 {
 setCursor(x,1);
 write(num[i][j]);
 buzzer();
 setCursor(x,1);
 write('*');
 x++;
 pass[k++]=num[i][j];
 while(digitalRead(row[j])==0); 
 } 
 }
 digitalWrite(col[i], HIGH);
 }
 }
 }
Dirk
3,7493 gold badges19 silver badges27 bronze badges
asked May 21, 2020 at 22:43

1 Answer 1

1

I am not going to try to debug code with an unknown requirements specification.

I will point out that the loop will not leave while k is less than 4. I would think about why k is not changing.

answered May 22, 2020 at 8:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.