Arduino Adafruit GFX: Printing to the TFT Screen

Using a TFT like a Serial Monitor

The Adafruit GFX library drawChar() command allows you to print single character.   To print entire words or sentences,  you will want to you use the print() or println() functions.

To use these functions,  you will set the text position, size, and color in separate statements.

Some Stuff You Might Want to Know First

Using the Adafruit GFX library requires a knowledge about screen coordinates and how to specify color.   I’ve written a couple of articles about these things.

Arduino Adafruit GFX Library Coordinate System

How to Specify 16 bit Color

About My Set Up

My tutorials on the Adafruit GFX Library are based on the set up I used in the 128 x 128 TFT tutorial found HERE.

If you wish to buy the display I use,  you can find it at the sellers found below:

eBay      Amazon     Ali-Express

Using setCursor()

This command sets the starting position for the print() and the println() functions.   It takes two arguments that specify the upper left hand corner of the first character that is printed.

Adafruit GFX setCursor

Using setTextSize()

This command is used to set the size of the text.  The space occupied by a character when the text size is ‘1’ using the standard font is six pixels wide by eight pixels high.

A two character string sent with this command will therefore occupy a space that is 12 pixels wide by eight pixels wide.

Other sizes are multiples of this size.  Thus, the space occupied by a character the the text size is ‘3’ is 18 pixels wide by 24 pixels high.

The command only excepts integers are arguments

Adafruit GFX setTextSize

Using setTextColor()

This commands sets both the text color and the background color that the text will print on.

The background color is optional.  If not specified, the text will use the current fill screen color.

Adafruit GFX setTextColor

Using setTextWrap()

This command determine how longer text strings are handled.

When the argument is set to ‘true’,  the text string will wrap to the next line.

When set to ‘false’,  the text will continue off the screen.

Adafruit GFX setTextWrap

Arduino Adafruit GFX TFT Printing Sample Sketch

There is nothing fancy about the sketch below.   It simple demonstrates the use of the commands described above and how they affect printing on the screen.

// Henry's Bench
//  Adafruit GFX printing
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <TFT_ILI9163C.h>

// Pallete - Where you assign names to colors you like
#define BACKCOLOR 0x0000 
#define CHARBACK 0x001F

#define CS 10
#define DC 9

// Declare an instance of the ILI9163

TFT_ILI9163C tft = TFT_ILI9163C(CS, 8, DC);

void setup() {

  tft.println("Size: 1");

  tft.println("Size: 2");

  tft.println("The quick brown fox jumps.");
  tft.println("The quick brown fox jumps.");

void loop(){