TFT

Description

The base class for drawing to the Arduino TFT screen. Use this to create an named instance of the TFT class to refer to in your sketch.

Syntax


TFT(cs, dc, rst); // for using hardware SPI
TFT(cs, dc, mosi, sclk, rst); // for use on any pins

Parameters

cs: pin for chip select (int)
dc: pin used for D/C (int)
rst: pin used for reset (int)
mosi: pin used for MOSI communication when not using hardware SPI (int)
sclk: pin used for the shared clock, when not using hardware SPI (int)

Returns

none

Example

#include <SPI.h>
#include <TFT.h>

#define cs   10
#define dc   9
#define rst  8

TFT screen = TFT(cs, dc, rst);

void setup() {
  // initialize the screen
  screen.begin();

  // make the background black
  screen.background(0,0,0);

  // set the stroke color to white
  screen.stroke(255,255,255);

  // turn off fill coloring
  screen.noFill();

  // draw a rectangle in the center of screen
  screen.line(screen.width()/2-5, screen.height()/2-5, 10, 10);
}

void loop() {

}

See also

noStroke()
stroke()
point()


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.