The LCD has a 2.8" or 3.2" 4-wire resistive touch screen glued onto it. You can use this for detecting finger-presses, stylus', etc. You'll need 4 pins to talk to the touch panel, and at least 2 must be analog inputs. The touch screen is a completely separate part from the TFT, so be aware if you rotate the display or have the TFT off or reset, the touch screen doesn't "know" about it - its just a couple resistors!
We have a demo for the touchscreen + TFT that lets you 'paint' simple graphics. There's versions for both SPI and 8-bit mode and are included in the libraries. Just make sure you have gone thru the TFT test procedure already since this builds on that.
Begin by grabbing our analog/resistive touchscreen library from the Arduino library manager.
Open up the Arduino library manager:
Search for the Adafruit TouchScreen library and install it
We also have a great tutorial on Arduino library installation at:
An additional 4 pins are required for the touchscreen. For the two analog pins, we'll use A2 and A3. For the other two connections, you can pin any two digital pins but we'll be using D9 (shared with D/C) and D8 since they are available. We can save the one pin by sharing with D/Cbut you can't share any other SPI pins. So basically you can get away with using only three additional pins.
Wire the additional 4 pins as follows:
- Y+ to Arduino A2
- X+ to Arduino D9 (Same as D/C)
- Y- to Arduino D8
- X- to Arduino A3
Another 4 pins seems like a lot since already 12 are taken up with the TFT but you can reuse some of the pins for the TFT LCD! This is because the resistance of the panel is high enough that it doesn't interfere with the digital input/output and we can query the panel in between TFT accesses, when the pins are not being used.
We'll be building on the wiring used in the previous drawing test for UNO
You can wire up the 4 touchscreen pins as follows. Starting from the top
- Y- connects to digital #9 (also D1)
- The next one down (X-) connects to Analog 2 (also C/D)
- The next one over (Y+) connects to Analog 3 (also CS)
- The last one (X+) connects to digital 8. (also D0)