How to detect an read buttons pressure on touchscreen I made simple 3 red buttons like this:

#include &lt;SPI.h&gt;

#include "Adafruit_GFX.h"     
#include "Adafruit_ILI9341.h" 
#include "URTouch.h"          

#define TFT_DC 9              
#define TFT_CS 10             
#define TFT_RST 8             
#define TFT_MOSI 11           
#define TFT_CLK 13            
#define TFT_IRQ  7          

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, 

#define t_SCK 3               
#define t_CS 4                
#define t_MOSI 5              
#define t_MISO 6             
#define t_IRQ 7               

URTouch ts(t_SCK, t_CS, t_MOSI, t_MISO, t_IRQ); 

void setup() {

  tft.begin();
  tft.fillScreen(BLACK);

  tft.fillRoundRect (12,15,30,80,5,RED);//50,100,30,80,5,RED
  tft.fillRoundRect (50,15,30,80,5,RED);
  tft.fillRoundRect (88,15,30,80,5,RED);

  delay(500);
}


And this the part where I need help:

void loop()
{
  int x, y;                         

  while(ts.dataAvailable())         
  {
    ts.read();                //-----------&gt; this is the whole thing      
    x = ts.getX();                  
    y = ts.getY();                  

  }


What I need is, to know how to detect and read the pressure of the button area, so that I can run different tasks.
The fillRoundRect function format is (initial_Xpoint,initial_Ypoint,length,width,corner_radius,color)

Therefore, you already have the information about the location of the button itself. Next, check if the x and y value is within the button area.

void setup() {

  tft.begin();
  tft.fillScreen(BLACK);

  tft.fillRoundRect (12,15,30,80,5,RED);  //button1
  tft.fillRoundRect (50,15,30,80,5,RED);  //button2
  tft.fillRoundRect (88,15,30,80,5,RED);  //button3


  delay(500);
}

void loop()
{
  int x, y, pressedbutton=0;                         

  if(ts.dataAvailable())         
  {
    ts.read();                //-----------&gt; this is the whole thing      
    x = ts.getX();                  
    y = ts.getY();                  

    if ((x&gt;=12) &amp;&amp; (x&lt;=12+30) &amp;&amp; (y&gt;=15) &amp;&amp; (y&lt;=15+80)) pressedbutton = 1; else
    if ((x&gt;=50) &amp;&amp; (x&lt;=50+30) &amp;&amp; (y&gt;=15) &amp;&amp; (y&lt;=15+80)) pressedbutton = 2; else
    if ((x&gt;=88) &amp;&amp; (x&lt;=88+30) &amp;&amp; (y&gt;=15) &amp;&amp; (y&lt;=15+80)) pressedbutton = 3; 
  }

  ...
  ...
  ...
 }