TFT Program
TFT Program
#define addr 0
int currentpage;
void drawHome()
{
tft.fillScreen(CYAN);
tft.drawRoundRect(0, 0, 319, 240, 8, WHITE); //Page border
tft.setCursor(20, 10);
tft.setTextSize(3);
tft.setFont();
tft.setTextColor(YELLOW);
tft.print("Techno!!");
tft.setCursor(70, 35);
tft.setTextSize(2);
tft.setTextColor(BLACK);
tft.print("menu orders");
tft.setTextColor(BLACK);
tft.setCursor(90, 76);
tft.print("North Indian");
tft.setCursor(85, 195);
tft.print(" Chats");
tft.setCursor(107, 155);
tft.print("Chineese");
tft.setCursor(85, 112);
tft.print("South Indian");
}
void setup()
{
tft.reset();
tft.begin(tft.readID());
Serial.begin(9600);
Serial.println();
Serial.print("reading id...");
delay(500);
Serial.println(tft.readID(), HEX);
tft.fillScreen(BLACK);
tft.setRotation(1);
currentpage = 0;
tft.setTextSize(3);
tft.setTextColor(WHITE);
tft.setCursor(50, 140);
tft.print("Welcome");
tft.setCursor(30, 100);
tft.print("Techno!!");
drawHome();
}
void loop()
{
digitalWrite(13, HIGH);
TSPoint p = ts.getPoint(); // Read touchscreen
digitalWrite(13, LOW);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
if (currentpage == 0)
{
if (p.z > 10 && p.z < 1000)
{
if (p.x > 736 && p.x < 855 && p.y > 255 && p.y < 725 && p.z > MINPRESSURE &&
p.z < MAXPRESSURE)
{
Serial.println("Chats");
delay(70);
tft.fillRoundRect(60, 180, 200, 40, 8, RED);
tft.drawRoundRect(60, 180, 200, 40, 8, WHITE);
tft.setCursor(85, 195);
tft.println(" Chats");
delay(70);
}
// delay(500);
currentpage = 1;
tft.fillScreen(CYAN);
tft.drawRoundRect(0, 0, 319, 240, 8, WHITE); //Page border
tft.setCursor(90, 76);
tft.print("North Indian");
tft.setCursor(85, 195);
tft.print(" Chats");
tft.setCursor(107, 155);
tft.print("Chineese");
tft.setCursor(85, 112);
tft.print("South Indian");
// delay(500);
}
else if (p.x > 600 && p.x < 683 && p.y > 275 && p.y < 750)
{
Serial.println("Chineese");
tft.print("Chineese");
delay(70);
currentpage = 2;
tft.fillScreen(CYAN);
tft.drawRoundRect(0, 0, 319, 240, 8, WHITE); //Page border
tft.setCursor(90, 76);
tft.print("North Indian");
tft.setCursor(85, 195);
tft.print(" Chats");
tft.setCursor(107, 155);
tft.print("Chineese");
tft.setCursor(85, 112);
tft.print("South Indian");
// delay(500);
}
if (p.x > 500 && p.x < 525 && p.y > 271 && p.y < 725)
{
Serial.println("Oscilloscope");
currentpage = 3;
tft.setCursor(85, 112);
tft.print("South Indian");
delay(70);
tft.setCursor(90, 76);
tft.print("North Indian");
tft.setCursor(85, 195);
tft.print(" Chats");
tft.setCursor(107, 155);
tft.print("Chineese");
tft.setCursor(85, 112);
tft.print("South Indian");
// delay(500);
}
}
}