Touch Shield not showing "touched" locations

Here is a sample of the test code I am using to show the location of where the shield is being touched

if (p.z > 500) {

Serial.print("Raw X = “); Serial.print(p.x);
Serial.print(”\tRaw Y = “); Serial.print(p.y);
Serial.print(”\tPressure = "); Serial.println(p.z);
}

No matter where I touch the shield, I receive the same X/Y coordinates.

Arduino UNO R3
Arduino IDE 1.0.1

hi~ your code seems right, maybe something else was wrong . or can you send me all the code?

Forgot to mention that I am using V1 Touch Shield
Below is the code

#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>

#ifdef SEEEDUINO
#define YP A2 // must be an analog pin, use “An” notation!
#define XM A1 // must be an analog pin, use “An” notation!
#define YM A0 // can be a digital pin, this is A0
#define XP A3 // can be a digital pin, this is A3
#endif

#define TS_MINX 140
#define TS_MAXX 900
#define TS_MINY 120
#define TS_MAXY 940

TouchScreen ts = TouchScreen(100, A2, A1, 100, 300);

void setup()
{
Serial.begin(9600);

Tft.init(); //init TFT library

}

void loop () {
int MapX1 = 239;
int MapX2 = 0;
int MapY1 = 319;
int MapY2 = 0;

// a point object holds x y and z coordinates
Point p = ts.getPoint();

p.x = map(p.x, TS_MINX, TS_MAXX, MapX1, MapX2);
p.y = map(p.y, TS_MINY, TS_MAXY, MapY1, MapY2);

if (p.z > 500) {

Serial.print("Raw X = “); Serial.print(p.x);
Serial.print(”\tRaw Y = “); Serial.print(p.y);
Serial.print(”\tPressure = "); Serial.println(p.z);

delay(1000);

}
}

Hi,your codes have some problems,so you get the same location.

Why don’t you use the demo show on our wiki?

yes, we try the demo code, and it works .

The demo code DOES NOT work.

line - “if(Tft.IC_CODE == 0x5408) //SPFD5408A TFT driver based Touchscreen hardware detected”
gives me the error…"class TFT’ has no member named ‘IC_CODE’ "

TFT.h I got from the link on the wiki page.

This part of the void initTouchScreenParameters() I had to delete to get it to function

if(Tft.IC_CODE == 0x5408) //SPFD5408A TFT driver based Touchscreen hardware detected
{
#if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
ts = TouchScreen(54, A1, A2, 57, 300); //init TouchScreen port pins
#else
ts = TouchScreen(14, A1, A2, 17, 300); //init TouchScreen port pins
#endif
//Touchscreen parameters for this hardware
TS_MINX = 120;
TS_MAXX = 910;
TS_MINY = 120;
TS_MAXY = 950;

MapX1 = 239;
MapX2 = 0;
MapY1 = 0;
MapY2 = 319;

Hi,those codes on our libraries can accomplish the function of “touched” locations :

[code]#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>
#ifdef SEEEDUINO
#define YP A2 // must be an analog pin, use “An” notation!
#define XM A1 // must be an analog pin, use “An” notation!
#define YM 14 // can be a digital pin, this is A0
#define XP 17 // can be a digital pin, this is A3
#endif

#ifdef MEGA
#define YP A2 // must be an analog pin, use “An” notation!
#define XM A1 // must be an analog pin, use “An” notation!
#define YM 54 // can be a digital pin, this is A0
#define XP 57 // can be a digital pin, this is A3
#endif

//Measured ADC values for (0,0) and (210-1,320-1)
//TS_MINX corresponds to ADC value when X = 0
//TS_MINY corresponds to ADC value when Y = 0
//TS_MAXX corresponds to ADC value when X = 240 -1
//TS_MAXY corresponds to ADC value when Y = 320 -1

#define TS_MINX 140
#define TS_MAXX 900

#define TS_MINY 120
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

void setup(void) {
Serial.begin(9600);
}

void loop(void) {
// a point object holds x y and z coordinates
Point p = ts.getPoint();

if (p.z > ts.pressureThreshhold) {
Serial.print("Raw X = “); Serial.print(p.x);
Serial.print(”\tRaw Y = “); Serial.print(p.y);
Serial.print(”\tPressure = "); Serial.println(p.z);
}

p.x = map(p.x, TS_MINX, TS_MAXX, 240, 0);
p.y = map(p.y, TS_MINY, TS_MAXY, 320, 0);

// we have some minimum pressure we consider ‘valid’
// pressure of 0 means no pressing!
if (p.z > ts.pressureThreshhold) {
Serial.print("X = “); Serial.print(p.x);
Serial.print(”\tY = “); Serial.print(p.y);
Serial.print(”\tPressure = "); Serial.println(p.z);
}

delay(100);
}[/code]

Did you have try it? Did you not compile it right?