I bought this display on Amazon.
Ther seller provided a link to a project that did not work off the bat, which is not at all unusual in the Arduino world:
Found one problem in the library and fixed it (the function that was supposed to return the driver chip's ID did not work, it is apparently a problem with the board itself.) I tried the various IDs referenced in the library and found one that worked, 0x9341.
tft.begin( identifier );
tft.begin( 0x9341 );
Among the different chip IDs in the library (I tried them all), one worked but with a mirrored image. I tried the other IDs and 0x9341 provided a non-flipped image. I did not have to make any change to the library itself. So before trying all sorts of mods in the library, just try the different IDs. Here are those that are referenced in the library:
Then the keypad did not work, I checked the LCD with an ohmmeter between an analog pin and a digital pin until I read about 360 Ohms. That was XP and XN, the rest was easy.
#define YP A2 #define XM A1 #define YM 6 #define XP 7
I got two displays from the same vendor a few days apart. I fully expected them to be the same, or at least work the same. I would not have made that assumption if they had been bought a month apart but it was not the case. Well, I was wrong... They look the same but the touchpad part numbers are different, HSD028266 for the one that works with my sample code, and HSD-8985J for the second one which returns completely different coordinates for the same points on the screen...Here is how I modified the retrieveTouch() routine for the two touch panels:
// display #1 with touch panel HSD-8985J X = map( p.y, TS_MAXX, TS_MINX, 0, tft.width() ); Y = map( p.x, TS_MAXY, TS_MINY, 0, tft.height() ); // display #2 with touch panel HSD028266 X = tft.width() - map( p.x, TS_MAXX, TS_MINX, 0, tft.width() ); Y = map( p.y, TS_MAXY, TS_MINY, 0, tft.height() );