calling functions not working while inside a while loop

in the code below im trying to call the function (timerfunctions():wink: it it is only cycling once can anyone help with why it is doing this and how to fix it so it continually loops while inside the the while loop

void codeinputcheck() {
  if (codeinputcheckctrl == 0)
  {
    i = 0;                    
    a = 0;
    j = 0;
    clearscreen();
    lcd.setCursor(0, 1);
    lcd.print(" Enter the  code to ");
    lcd.setCursor(0, 2);
    lcd.print("  defuse the bomb!  ");
    codeinputcheckctrl = 1;
  }
  while (customKey != 'A' ) {             
    customKey = customKeypad.getKey();
    if (customKey != NO_KEY && customKey != 'A' ) {     
      lcd.setCursor(j + 7, 3);                                  
      lcd.print(customKey);
      j++;
    }
    timerfunctions();
    if (customKey == code[i] && i < sizeof(code)) {       
      a++;                                              
      i++;
    }
    else {
      a--;                                               
    }
  }
  customKey = NO_KEY;
}

Please follow the advice on posting code given in posting code

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

done

Please post ALL the code. The snippet is useless, as it lacks variable declarations, etc.

it dosen't let me as the whole code is more than 1100 lines

We could help a lot more if we could see your entire sketch.

What is customKey set to before the while loop gets executed? How is he array code defined?

samwells2000:
it dosen't let me as the whole code is more than 1100 lines

Either reduce the code to a sketch that demonstrates the problem or attach the entire sketch.

how do i attach a file to the forum? i cant boil the code down enough to fit in.

customKey is set the the input form a keypad

how do i attach a file to the forum? i cant boil the code down enough to fit in.

Click the Reply button and the option to attach a file is at the bottom left of the page

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.