The LCD has a 2.8" 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. We can save the one pin by sharing with D/C but 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 D4
- Y- to Arduino D5
- X- to Arduino A3
Load up the breakoutTouchPaint example from the Adafruit_ILI9341 library and try drawing with your fingernail! You can select colors by touching the 'pallette' of colors on top
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)
The X- and Y+ pins pretty much have to connect to those analog pins (or to analog 4/5) but Y-/X+ can connect to any digital or analog pins.
Load up the tftpaint example from the Adafruit_TFTLCD library and try drawing with your fingernail! You can select colors by touching the 'pallette' of colors on the right