TFT LCD library

This library enables an 86Duino board to communicate with the Arduino TFT LCD screen. It simplifies the process for drawing shapes, lines, images, and text to the screen.

The 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 specific additions in the TFT library were designed to work as similarly to the Processing API as possible.

The TFT library relies on the SPI library for communication with the screen, 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 86Duino’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. All examples in the library are written for hardware SPI use.

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

#define CS   7
#define DC   0
#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.

#define SCLK 4
#define MOSI 5
#define CS   6
#define DC   7
#define RESET 8 

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

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.

Functions

TFT
begin()
background()
stroke()
noStroke()
fill()
noFill()
text()
setTextSize()
point()
line()
rect()
width()
height()
circle()
image()
loadImage()
PImage
PImage.height()
PImage.width()
PImage.isValid()

Examples

The following are examples of the TFT library from the Arduino Tutorial that can work on the 86Duino boards (note that on 86Duino, you should use the SD slot on 86Duino instead of that on the Arduino TFT LCD screen):

TFT Bitmap Logo: Read an image file from a micro-SD card and draw it at random locations.
TFT Display Text : Read the value of a sensor and print it on the screen.
TFT Pong: An implementation of the classic game
Etch a Sketch: An implementation of the classic Etch-a-Sketch
Color Picker: With three sensors, change the color of the TFT screen
Graph: Graph the values from a variable resistor to the TFT


DEMO VIDEO


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.