{
TSPoint p = ts.getPoint();
// if sharing pins, you'll need to fix the directions of the touchscreen pins
//pinMode(XP, OUTPUT);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
//pinMode(YM, OUTPUT);
// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!
if (p.z > MINPRESSURE && p.z < MAXPRESSURE)
{
// scale from 0->1023 to tft.width
p.x = tft.width()-(map(p.x, TS_MINX, TS_MAXX, 0,tft.width())); //swapped
p.y = tft.height()-(map(p.y, TS_MINY, TS_MAXY, 0,tft.height())); //swapped
if (p.y > 0 && p.y < tft.height() && p.x > 0 && p.x < tft.width())
{
do stuff... go to sub and read what soft button pressed
Sub kicks back error p not declared
}