I'm making a Tetris game with an LCD screen and 4 buttons. The game is complete with control and scoring mechanism.
But when I'm trying to add initials to my high score system it stops taking input from all of the buttons.
This code should according to my intention display the three initials, which it does. after the initials there is a counter, displaying seconds since startup. This too works as intended.
The last ,j, variable should increase once every time i press the right button. See below for the right() code. Sadly it does not, and i have no clue as to why. Any clever minds out there who can help me with this?
The program will never exit the while loop, but that is not a problem for now.
String typeInitials(){
boolean initialsSet = false;
String initials = "MMM";
int i = 0;
int j = 0;
int currentChar = initials.charAt(0);
while(!initialsSet){
lcd.setCursor(i+5, 3);
lcd.print(initials);
lcd.print(millis()/1000);
lcd.print(" ");
if(right()){
j += 1;
}
lcd.print(j);
}
return initials;
}
right()
boolean right(){
if (Right == HIGH) {
if (Rf == 1){
Rf = 0;
return true;
}
}else {
Rf = 1;
}
return false;
}