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,541
  • 3
  • 18
  • 25
chenko
  • 1

1 Answers1

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.

joan
  • 71,024
  • 5
  • 73
  • 106