Endless Looping Between Screens
i have title screen , can push 2 buttons in order obtain data on other screens. when go other screens screens flash between each other endlessly , continue button not work. need make pages stable can navigate , forth between pages back, continue , home button.
i want stabilize pages user navigating between them. not sure how stop looping.
here void loop()
i want stabilize pages user navigating between them. not sure how stop looping.
here void loop()
code: [select]
void setup() {
// put setup code here, run once:
myglcd.initlcd();
myglcd.clrscr();
mytouch.inittouch();
mytouch.setprecision(prec_medium);
drawhomescreen(); // draws home screen
currentpage = '0'; // indicates @ home screen
}
void loop() {
// home screen
if (currentpage == '0') {
if (mytouch.dataavailable()) {
mytouch.read();
x=mytouch.getx(); // x coordinate screen has been pressed
y=mytouch.gety(); // y coordinates screen has been pressed
}
// if press east ridge button
if ((x>=35) && (x<=285) && (y>=90) && (y<=155)) {
drawframe(35, 90, 285, 155); // custom function -highlighs buttons when it's pressed
currentpage == '1'; // indicates eastridge
myglcd.clrscr(); // clears screen
draweastridge(); // called once, because in next iteration of loop, above if statement false function won't called. function draw graphics of first example.
}
// if press west ridge button
if ((x>=35) && (x<=285) && (y>=165) && (y<=230)) {
drawframe(35, 165, 285, 230);
currentpage == '2'; //indicates westridge
myglcd.clrscr();
drawwestridge();
}
}
//east ridge page 1 data shown
if (currentpage == '1') {
if (mytouch.dataavailable()) {
mytouch.read();
x=mytouch.getx(); // x coordinate screen has been pressed
y=mytouch.gety(); // y coordinates screen has been pressed
}
if ((x>=130) && (x<=255) && (y>=190) && (y<=220)) { //press continue button
drawframe(130, 190, 255, 220);
currentpage == '3';
myglcd.clrscr();
draweastridge2();
}
} //close currentpage2
//west ridge page 1 data shown
if (currentpage == '2') {
if (mytouch.dataavailable()) {
mytouch.read();
x=mytouch.getx(); // x coordinate screen has been pressed
y=mytouch.gety(); // y coordinates screen has been pressed
}
if ((x>=130) && (x<=255) && (y>=190) && (y<=220)) { //press continue button
drawframe(130, 190, 255, 220);
myglcd.clrscr();
currentpage == '4';
drawwestridge2();
}
} //close data avaialable
} //void loop
Arduino Forum > Using Arduino > Displays > Endless Looping Between Screens
arduino
Comments
Post a Comment