3.2 tft lcd is working but touch sensor experiencing some issues

I am using sainsmart 3.2" tft lcd touch screen, its display and touch are working fine as I,ve seen by using calibration program but the trouble I am facing is that its touch is not sending positions on x and y of pixels, so code in the example of ITBD02_Touch ' ITDB02_Touch_ButtonTest ' gives me the proper display but not sensing touch.
As I,ve concluded that the this program enters the numbers by extracting the pixel position from the command x=myTouch.getX();
y=myTouch.getY();
where you touch on the screen that is why it is not sensing any button in this code.
Libraries I am using are UTFT and ITDB02_Touch.
Someone please help me.

Most calibration programs will show your X and Y on the Serial terminal

You should get one corner that is two low values like 300, 300 and the opposite corner with two high values like 3500, 3500.

If you do not get normal values e.g. 300 - 3500, something is not correct.

Most calibration programs do not explain the results. They just calculate some magic values from garbage input without complaint.

So look at the values on the Serial Terminal

David.

Run the calibration again and make sure you update the calibration factors in your library file ITDB02_Touch.cpp

These are the defaults which might not be right and will need to be changed:

#define PixSizeX -15.48
#define PixOffsX 180
#define PixSizeY 11.03
#define PixOffsY 321

Run the calibration sketch a few times to make sure you get roughly the same numbers each time. You could edit this calibration sketch to report the detected raw values (cx and cy) to the serial port for checking the range as suggested by david.

After changing ITDB02_Touch.cpp. edit the buttons sketch to output the touch detected X and Y values to the serial port. When touching a button do the serial port values correspond to the correct position of the button? The pixel x and y values should be in the range 0 to 319 and 0 to 239

During calibration raw x and y values are read, a set of coordinate transform variables are calculated, these are the #defines above, if these are not right then the translation of the raw values to the pixel coordinates will be wrong. There are complications in that the touch screen and TFT screen rotations and mirroring (left-right swap) are different from different manufacturers, but the calibration sketch should sort this out automatically.

I tried as you said but couldn't get it work. As far as touch is concerned, I tried to get it serially printed but code stopped responding, I am not sure what the issue is. When I change values as suggested above, code hanged and it did not move further after touching the screen, in the calibration code. Touch some time works, even if calibration program run till the end, these are the value I get in the end

PixSizeX 0.00
PixOffsX 0
PixSizeY 0.00
PixOffsY 0

and it says that module connected is 2.4", in fact I am using 3.2".

This is the simplest code that I managed to write to check which part is not responding really, so can some one please guide me what should I do to make it work

////////////////////////////////////////

#include<UTouch.h>
UTouch myTouch( 6, 5, 4, 3, 2);
int x, y;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
}

void loop() {
// put your main code here, to run repeatedly:
if (myTouch.dataAvailable())
{
Serial.print("Touch");
Serial.print("\t");
myTouch.read();
x=myTouch.getX();
y=myTouch.getY();
myTouch.read();
Serial.print(x);
Serial.print(",");
Serial.print(y);
}
else { }
}
////////////////////////////////////////

"Touch -1,-1", every time I touch I get this on serial print

While using ITDB02_touch.h, I get 'Touch 4832,0' on serial print, with the same code but different library

Please post a link to the ACTUAL display and Adapter shield that you are using.

I do not have any Sainsmart displays. I would guess that UTFT will work with the specific SSD1289 display and specific Mega Adapter shield.

Use the UTouch.h touch library with the UTFT.h display library.

David.

Shield which I am using is: http://www.elecfreaks.com/store/lcd-tft01-mega-shield-v10-p-214.html
LCD is not from Sainsmart but Elecfreak's : http://www.elecfreaks.com/wiki/index.php?title=3.2"_TFT_LCD_Screen_Module

I am using these on 'Funduino Mega 2560 ATMEGA2560 16AU'

I am sure that several people will have the same display and Adapter. Note that there are a lot of differences electrically between v1.4 and v2.0 schematic. I think that v1.4 pcb is blue and v2.0 is white.

Otherwise it looks like you use exactly the same Arduino pins for the Touch Controller. e.g. use <UTouch.h> library.

David.