Hello everyone, I'm somewhat intermediate at programming, but I've been having real problems developing my own version of tic tac toe with bi-directional LEDs. I have been going over and over this function but can't figure out why it isn't printing correctly. My code necessitates that I individually check each index by using i and j equals the index values.
bool buttonPressAndMatrixUp(boolean player) {
int repeatCheck = 0; //used in a different function that won't affect this function
bool flagTurn = 0; //used to change the status of a turn in the whole code
int i2 = 0; //for some reason I think initializing is breaking my for loops in the same line as the for code
int j2 = 0;
for (i2; i2 < rows; i2++){ //rows already equals 3 as a const int at the beginning
for (j2; j2 < columns; j2++){ //columns also equals 3 as a const int at the beginning of my sketch
if (i2 == 0 && j2 == 0){
//Serial.println("R1C1"); this works fine, so I commented it
} else if (i2 == 0 && j2 == 1){
//Serial.println("R1C2"); also works
} else if (i2 == 0 && j2 == 2){
//Serial.println("R1C3"); also works
} else if (i2 == 1 && j2 == 0) {
Serial.println("R2C1"); //this doesn't work at all, it is driving me mad
}
}
The last print never executes and I can't figure out why. It should let i2 = 0 and j2 to loop 3 times and update i2 to 1, but it seems like it doesn't. Am I doing things wrong?