My robot has to travel a maze. Maze is divided into cells, each cell defined by x,y coordinate. I want to print the stack array full of all the x values it has printed and another stack array of y values. The problem is I do not know what command will make it serial print the entire values in either the x o y stack array as the robot navigates through the maze so the array keeps getting bigger. Right now, it only prints the x, y values in the cell maze passes.
I am using following:
x_position.push(x);
y_position.push(y);
Serial.print(x_position.pop());
Serial.print(" x vector ");
Serial.print(y_position.pop());
Serial.print(" y vector ");
By logic, it is supposed to print only the value it got of the current cell. Can anyone let me know how to modify it to print all the x and y values in their respective arrays, namely x_position and y_position?