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 8902
#define TS_MINY 832
#define TS_MAXY 9132
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