TFT LCD suddenly only reads one x value when touching it

So I just finished my project and I had checked everything worked, then couple days go by and now that I was going to put the project to work, the touch screen only reads one value for the x-axis.

What's weird is that it's a 3.5", so it's 480×320 pixels, x-axis is 320 yet it says 365..

See picture:

Not sure what is wrong, can it be that I somehow damaged the hardware somehow or is there something software side that I'm not aware off? (everything worked fine when I tested it couple days ago).

Here's the part of the code that handles touch

#include <LCDWIKI_GUI.h> //Core graphics library #include <LCDWIKI_KBV.h> //Hardware-specific library #include <stdint.h> #include <string.h> #include "TouchScreen.h" #define YP A1 // must be an analog pin, use "An" notation! #define XM A2 // must be an analog pin, use "An" notation! #define YM 7 // can be a digital pin #define XP 6 // can be a digital pin #define MINPRESSURE 5 #define MAXPRESSURE 2000 #define TS_MINX 176 #define TS_MINY 176 #define TS_MAXX 918 #define TS_MAXY 953 LCDWIKI_KBV mylcd(ILI9486, A3, A2, A1, A0, A4); //model,cs,cd,wr,rd,reset TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300); void setup(){ mylcd.Init_LCD(); //initialize lcd mylcd.Set_Rotation(2); Serial.begin(9600); } void loop(){ digitalWrite(13, HIGH); // a point object holds x y and z coordinates TSPoint p = ts.getPoint(); digitalWrite(13, LOW); pinMode(YP, OUTPUT); pinMode(XM, OUTPUT); p.x = map(p.x, TS_MAXX, TS_MINX, 320, 0); p.y = map(p.y, TS_MAXY, TS_MINY, 480, 0); // pressure of 0 means no pressing if (p.z > MINPRESSURE && p.z < MAXPRESSURE) { Serial.print("X = "); Serial.print(p.x); Serial.print("\tY = "); Serial.print(p.y); Serial.print("\tPressure = "); Serial.println(p.z); } 

Any thoughts on what might be going on?

Touch here for the full post on the Arduino Apprentices tumblr

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s