Hi, Impulsive, thanks for your reply. here part of the code with a little more info., it wont let me post the full version it seems to have hit its character limit, and yes At this time it is running through the pages.
this is for a vu meter update update on my youtube channel. ( cine-lights ) obviously any help, credit will be given as always in the posting of the video. thanks again
void drawpageone()
{
tft.fillScreen(BLACK);
tft.drawRoundRect(0, 0, 479, 319, 8, RED); //Page border
tft.setTextSize(2);
tft.setCursor(170, 30);
tft.setTextColor(WHITE);
tft.print("CINE-LIGHTS");
tft.fillRoundRect(60, 100, 360, 40, 8, RED);
tft.drawRoundRect(60, 100, 360, 40, 8, WHITE);
tft.setTextColor(WHITE);
tft.setCursor(185, 115);
tft.print("VU Meters");
tft.setTextSize(3);
tft.setCursor(160, 200);
tft.setTextColor(WHITE);
tft.print("Vu Meter 12");
}
void drawpagetwo()
{
tft.fillScreen(BLACK);
tft.drawRoundRect(0, 0, 479, 319, 8, RED); //Page border
tft.setTextSize(2);
tft.setCursor(170, 30);
tft.setTextColor(WHITE);
tft.print("CINE-LIGHTS");
tft.fillRoundRect(60, 100, 360, 40, 8, RED);
tft.drawRoundRect(60, 100, 360, 40, 8, WHITE);
tft.setTextColor(WHITE);
tft.setCursor(185, 115);
tft.print("VU Meters");
tft.setTextSize(3);
tft.setCursor(160, 200);
tft.setTextColor(WHITE);
tft.print("Vu Meter 11");
}
void loop(void) {
digitalWrite(13, HIGH);
TSPoint p = ts.getPoint();
digitalWrite(13, LOW);
buttonEnabled = true;
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
if (currentPage == 0){
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
//map(value, fromLow, fromHigh, toLow, toHigh)
p.x = map( p.x, TS_MINX, TS_MAXX,0, 480 );
p.y = map( p.y, TS_MINY, TS_MAXY, 0, 320 );
if(p.x>60 && p.x<400 && p.y>100 && p.y<120 )// The user has pressed inside the red rectangle
{
currentPage = 1;
//// ...... PAGE 1 IS THE SAME AS PAGE 2 - HAD TO REMOVE IT DUE TO EXCEEDING CHARACTER
LIMIT
currentPage = 2;
tft.fillScreen(BLACK);
tft.drawRoundRect(0, 0, 479, 319, 8, BLUE); //Page border
// top row buttons
tft.fillRoundRect(40, 80, 80, 40, 8, RED);
tft.drawRoundRect(40, 80, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(74, 93);
tft.print("1");
tft.fillRoundRect(145, 80, 80, 40, 8, RED);
tft.drawRoundRect(145, 80, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(179, 93);
tft.print("2");
tft.fillRoundRect(255, 80, 80, 40, 8, RED);
tft.drawRoundRect(255, 80, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(289, 93);
tft.print("3");
tft.fillRoundRect(360, 80, 80, 40, 8, RED);
tft.drawRoundRect(360, 80, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(394, 93);
tft.print("4");
// middle row buttons
tft.fillRoundRect(40, 140, 80, 40, 8, RED);
tft.drawRoundRect(40, 140, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(74, 153);
tft.print("5");
tft.fillRoundRect(145, 140, 80, 40, 8, RED);
tft.drawRoundRect(145, 140, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(179, 153);
tft.print("6");
tft.fillRoundRect(255, 140, 80, 40, 8, RED);
tft.drawRoundRect(255, 140, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(289, 153);
tft.print("7");
tft.fillRoundRect(360, 140, 80, 40, 8, RED);
tft.drawRoundRect(360, 140, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(394, 153);
tft.print("8");
// lower row buttons
tft.fillRoundRect(40, 200, 80, 40, 8, RED);
tft.drawRoundRect(40, 200, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(74, 213);
tft.print("9");
tft.fillRoundRect(145, 200, 80, 40, 8, RED);
tft.drawRoundRect(145, 200, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(174, 213);
tft.print("10");
tft.fillRoundRect(255, 200, 80, 40, 8, RED);
tft.drawRoundRect(255, 200, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(284, 213);
tft.print("11");
tft.fillRoundRect(360, 200, 80, 40, 8, RED);
tft.drawRoundRect(360, 200, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(390, 213);
tft.print("12");
tft.fillRoundRect(380, 260, 60, 30, 8, RED);
tft.drawRoundRect(380, 260, 60 , 30, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(395, 268);
tft.print("<<");
tft.setTextSize(2);
tft.setCursor(170, 30);
tft.setTextColor(WHITE);
tft.print("STANDBY MENU");
if(p.x>390 && p.x<435 && p.y>270 && p.y<285 ){
currentPage = 0;
drawHomeScreen();
}
}
}
}
if (currentPage == 1){
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
//map(value, fromLow, fromHigh, toLow, toHigh)
p.x = map( p.x, TS_MINX, TS_MAXX,0, 480 );
p.y = map( p.y, TS_MINY, TS_MAXY, 0, 320 );
if(p.x>380 && p.x<470 && p.y>260 && p.y<300 ){
tft.fillRoundRect(380, 260, 60, 30, 8, BLACK);
tft.drawRoundRect(380, 260, 60 , 30, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(395, 268);
tft.print("<<");
currentPage = 0;
drawHomeScreen();
}
if(p.x>360 && p.x<470 && p.y>200 && p.y<300 ){
tft.fillRoundRect(360, 200, 80, 40, 8, BLACK);
tft.drawRoundRect(360, 200, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(390, 213);
tft.print("12");
currentPage = 0;
drawpageone();
}
if(p.x>255 && p.x<470 && p.y>200 && p.y<300 ){
tft.fillRoundRect(255, 200, 80, 40, 8, BLACK);
tft.drawRoundRect(255, 200, 80 , 40, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(284, 213);
tft.print("11");
currentPage = 0;
drawpagetwo();
}
}
} // end of page 1
if (currentPage == 2){
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
//map(value, fromLow, fromHigh, toLow, toHigh)
p.x = map( p.x, TS_MINX, TS_MAXX,0, 480 );
p.y = map( p.y, TS_MINY, TS_MAXY, 0, 320 );
if(p.x>380 && p.x<470 && p.y>260 && p.y<300 ){
tft.fillRoundRect(380, 260, 60, 30, 8, BLACK);
tft.drawRoundRect(380, 260, 60 , 30, 8, WHITE);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.setCursor(395, 268);
tft.print("<<");
currentPage = 0;
drawHomeScreen();
}
}
} // end of page 2
}