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);
    }
  }
 }

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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.