#include "TFT9341.h"
#include "touch.h"
word x,y;
void setup() {
lcd.begin();
lcdtouch.begin();
Serial.begin(9600);
lcdtouch.InitTypeTouch(2);//0,1,2
lcd.setRotation(2);//0,1,2,3
lcd.fillRoundRect (10,80,90, 90, 10 ,RED);
lcd.fillRoundRect (115,80,90, 90, 10 ,GREEN);
lcd.setFont(3);
lcd.setColor (BLACK);
}//End of setup function
void loop() {
while(digitalRead(2)==1);
delay(10);
lcdtouch.readxy();
x = lcdtouch.readx();
y = lcdtouch.ready();
if(x > 10 && x<10+90 && y> 80 && y< 80+90){
lcd.gotoxy(120,20);
lcd.print("RED");
lcd.print(" ");
}
else if(x > 115 && x<115+90 && y> 80 && y< 80+90){
lcd.gotoxy(120,20);
lcd.print("GREEN");
lcd.print(" ");
}
}