I have a title screen and can push two buttons in order to obtain data on other screens. But when I go to the other screens the screens flash between each other endlessly and the continue button does not work. Need to make the pages stable so that I can navigate back and forth between the pages with a back, continue and home button.
I want to stabilize the pages so that user is navigating between them. Not sure how to stop the looping.
Here is my void loop()
void setup() {
// put your setup code here, to run once:
myGLCD.InitLCD();
myGLCD.clrScr();
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
drawHomeScreen(); // Draws the Home Screen
currentPage = '0'; // Indicates that we are at Home Screen
}
void loop() {
// Home Screen
if (currentPage == '0') {
if (myTouch.dataAvailable()) {
myTouch.read();
x=myTouch.getX(); // X coordinate where the screen has been pressed
y=myTouch.getY(); // Y coordinates where the screen has been pressed
}
// If we press the East Ridge Button
if ((x>=35) && (x<=285) && (y>=90) && (y<=155)) {
drawFrame(35, 90, 285, 155); // Custom Function -Highlighs the buttons when it's pressed
currentPage == '1'; // Indicates that this is the EastRidge
myGLCD.clrScr(); // Clears the screen
drawEastRidge(); // It is called only once, because in the next iteration of the loop, this above if statement will be false so this function won't be called. This function will draw the graphics of the first example.
}
// If we press the West Ridge Button
if ((x>=35) && (x<=285) && (y>=165) && (y<=230)) {
drawFrame(35, 165, 285, 230);
currentPage == '2'; //Indicates that this the WestRidge
myGLCD.clrScr();
drawWestRidge();
}
}
//East Ridge page one data shown
if (currentPage == '1') {
if (myTouch.dataAvailable()) {
myTouch.read();
x=myTouch.getX(); // X coordinate where the screen has been pressed
y=myTouch.getY(); // Y coordinates where the screen has been pressed
}
if ((x>=130) && (x<=255) && (y>=190) && (y<=220)) { //press the Continue button
drawFrame(130, 190, 255, 220);
currentPage == '3';
myGLCD.clrScr();
drawEastRidge2();
}
} //close currentPage2
//West Ridge page one data shown
if (currentPage == '2') {
if (myTouch.dataAvailable()) {
myTouch.read();
x=myTouch.getX(); // X coordinate where the screen has been pressed
y=myTouch.getY(); // Y coordinates where the screen has been pressed
}
if ((x>=130) && (x<=255) && (y>=190) && (y<=220)) { //press the Continue button
drawFrame(130, 190, 255, 220);
myGLCD.clrScr();
currentPage == '4';
drawWestRidge2();
}
} //close data avaialable
} //void loop