Arduino TFT Library


TFT library is included in the Arduino IDE
This library enables an Arduino board to communicate with the Arduino TFT LCD screen. It simplifies the process for drawing shapes, lines, images, and text to the screen. 
The Arduino TFT library extends the Adafruit GFX, and Adafruit ST7735 libraries that it is based on. The GFX library is responsible for the drawing routines, while the ST7735 library is specific to the screen on the Arduino TFT. The Arduino specific additions were designed to work as similarly to the Processing API as possible. 
Onboard the screen is a SD card slot, which can be used through the SD library. 
The TFT library relies on the SPI library for communication with the screen and SD card, and needs to be included in all sketches.

Using the library

The screen can be configured for use in two ways. One is to use an Arduino's hardware SPI interface. The other is to declare all the pins manually. There is no difference in the functionality of the screen between the two methods, but using hardware SPI is significantly faster. 
If you plan on using the SD card on the TFT module, you must use hardware SPI. All examples in the library are written for hardware SPI use. 
If using hardware SPI with the Uno, you only need to declare the CS, DC, and RESET pins, as MOSI (pin 11) and SCLK (pin 13) are already defined.

  1. define CS 10
  2. define DC 9
  3. define RESET 8

TFT myScreen = TFT(CS, DC, RESET);

To use hardware SPI with the Leonardo, you declare the pins like so :

  1. define CS 7
  2. define DC 0
  3. define RESET 1

TFT myScreen = TFT(CS, DC, RESET);

When not using hardware SPI, you can use any available pins, but you must declare the MOSI and SCLK pins in addition to CD, DC, and RESET.

  1. define SCLK 4
  2. define MOSI 5
  3. define CS 6
  4. define DC 7
  5. define RESET 8


Using the Arduino Esplora and the TFT library

As the Arduino Esplora has a socket designed for the TFT, and the pins for using the screen are fixed, an Esplora only object is created when targeting sketches for that board. You can reference the screen attached to an Esplora through EsploraTFT.

Similarities to Processing

Processing is an open source software environment used by designers, artists, and students. The main output of Processing is a graphic window on a computer or browser. The Arduino TFT library has made the calls for drawing primitives and text to the screen as "Processing-like" as possible to ensure a smooth transition between the two environments.

Based on the reference originally written by Arduino Community, and