UNO R3 + Touch Screen TFT LCD Module 2.8 problem

Hi all, please help,

I have connected an Arduino UNO R3 to the Touch Screen TFT LCD Module 2.8 called ITDB02:

I’m using a touch screen driver library:

I’m trying to control the „touch“ like this:

#include <stdint.h>
#include <SeeedTouchScreen.h>

#define YP A2
#define XM A1
#define YM 14
#define XP 17

#define TS_MINX 1162
#define TS_MAXX 890
2
#define TS_MINY 832
#define TS_MAXY 913
2

ts = TouchScreen(XP, YP, XM, YM);

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

void loop(void)
{
Point p = ts.getPoint();

Serial.print("Raw: [");
Serial.print(p.x);
Serial.print(",\t");
Serial.print(p.y);
Serial.print("]");

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

Serial.print("\tNorm: [");
Serial.print(p.x);
Serial.print(",\t");
Serial.print(p.y);
Serial.print("]");
Serial.print("\tPressure = ");
Serial.println(p.z);

delay(500);
}

Program doesn’t read any valid data; the coordinates just drift around something like [700,1000], and the pressure is zero, sometimes occasionally a negative value:

Raw: [704, 1066] Norm: [73, 173] Pressure = 0
Raw: [703, 1066] Norm: [73, 173] Pressure = 0
Raw: [708, 1066] Norm: [73, 173] Pressure = -79
Raw: [716, 1066] Norm: [75, 173] Pressure = 0
Raw: [709, 1066] Norm: [73, 173] Pressure = 0
Raw: [709, 1066] Norm: [73, 173] Pressure = 0
Raw: [703, 1066] Norm: [73, 173] Pressure = 0
Raw: [704, 1066] Norm: [73, 173] Pressure = 0
Raw: [707, 1066] Norm: [73, 173] Pressure = -79
Raw: [712, 1066] Norm: [74, 173] Pressure = 0
Raw: [712, 1066] Norm: [74, 173] Pressure = 0
May the problem be in pins?
Do I use correct pins for this model?
Thanks for any tip!

Milan

Your problem is probably in your SeeedTouchScreen.cpp file... Look for the touchscreen config..

I fisrt don't understand why all of these lines are multiplicated by 2..

"#define TS_MINX 1162
#define TS_MAXX 890
2
#define TS_MINY 832
#define TS_MAXY 913
2"

For your z axis it may be relative to your xy problem or it is strangely inverted...

But set the lines to get

#define TS_MINX 116
#define TS_MAXX 890
#define TS_MINY 83
#define TS_MAXY 913

And try to look if you have the correct touchscreen Library