View on GitHub

ILI9341_due

Arduino Due library for interfacing with ILI9341 SPI TFTs

Download this project as a .zip file Download this project as a tar.gz file

ILI9341_due

A library for interfacing with ILI9341-based TFT's in SPI, Extended SPI and DMA SPI mode optimized for Arduino Due.

ILI9341 with Arduino Due

The library can also be used with Arduino AVR boards like Uno, Mega, Pro Mini, Nano, etc. It is faster than the original Adafruit one but do not expect DMA-like speed increase. It is comparable to some other tweaked Adafruit libraries out there and in addition you get things like custom fonts, arcs, images or ability to take screenshots. Btw. Not all library examples will work because of smaller ROM/RAM space available on AVRs.

ILI9341 with Arduino Pro Mini

This library is based on 3 libraries:

ili9341_t3 from Paul Stoffregen - https://github.com/PaulStoffregen/ILI9341_t3
SdFat from Bill Greiman - https://github.com/greiman/SdFat
GLCD from Michael Margolis and Bill Perry - https://code.google.com/p/glcd-arduino

ili9341_t3 library where various optimizations for Adafruit's ili9341 and GFX libraries were implemented was used as a base for ili9341_due.
One class from SdFat library is used for utilizing Due's DMA in SPI transfers which provides the main speed boost.
gText class from GLCD library was used as a base for rendering custom fonts.

As for the wiring, use Due's and AVR's HW SPI pins (e.g. described here). The pin for CS on Due depends on the SPI mode you choose (see SPI Mode section below for details).

ILI9341_due_config.h

Some of the default settings can be set in ILI9341_due_config.h file.

SPI Mode

// comment out the SPI mode you want to use
//#define ILI9341_SPI_MODE_NORMAL
//#define ILI9341_SPI_MODE_EXTENDED // make sure you use pin 4, 10 or 52 for CS
#define ILI9341_SPI_MODE_DMA

Uncomment the line depending on the SPI mode you want to use. DMA mode is the default. For AVR, it does not matter which mode you use, ILI9341_SPI_MODE_NORMAL is always going to be used since there is no Extended SPI or DMA available on AVRs.

SPI_MODE_NORMAL is the standard SPI mode where you can use any digital pin for CS. In this mode the library will drive the CS pin 'manually'.
SPI_MODE_EXTENDED is the extended SPI mode available in Due the CS pin is handled by the chip (which is faster than handling it in code 'manually'). You are restricted to these 3 pins for CS - 4, 10 and 52 (as described here).
SPI_MODE_DMA is utilizing D(irect) M(emory) A(ddress) to do SPI transfers. You can use use any digital pin for CS.

Here is a video where you can see the speed difference between the modes (v0.x version):

SPI clock divider

For Due:
#define ILI9341_SPI_CLKDIVIDER 2	// for Due

This is used to set the SPI clock frequency on Due, which for example when set to 10 will set the SPI clock frequency to 84MHz/10=8.4MHz. The minimum divider is 1 (84MHz) and maximum is 255 (329kHz). If you are getting glitches on the screen or it just does not work try to use a higher divider to bring the frequency down (e.g. 11 to run it at 8-ish MHz). I was using 20cm dupont cables to connect TFT with Due and haven't had any issues running it with the divider set to 2.

For AVR:
#define ILI9341_SPI_CLKDIVIDER SPI_CLOCK_DIV2	// for Uno, Mega,...

This is used to set the SPI clock frequency on AVR based boards (Uno, Mega,...). You can use one of these values:

You can change the clock divider at runtime by calling the setSPIClockDivider function.

Text

#define TEXT_SCALING_ENABLED

If you do not need scaled fonts (setTextScale function) then you can comment out the define to disable support for text scaling. Text will render a bit faster. Text scaling is enabled by default.

Scaled font:

#define DEFAULT_LETTER_SPACING 2

Set the default spacing between letters in pixels.

Different letter spacings:

#define DEFAULT_LINE_SPACING 0

Set the default spacing between lines in pixels.

Different line spacings:

#define LINE_SPACING_AS_PART_OF_LETTERS

If uncommented, the space between lines (defined by DEFAULT_LINE_SPACING) is filled with text background color. By default it is commented out/disabled.

If uncommented/enabled:

Arcs

#define ARC_ANGLE_MAX 360

This number represents the maximum equal to 360 degrees (full circle). The default is 360 so if you pass in start=25 and end=75 you'll get an arc going from 25 degrees to 75 degrees. If you set ARC_ANGLE_MAX 100 and you pass in start=0 and end=50 then you get a half circle (that can represent percentages). If you set ARC_ANGLE_MAX 2*PI, you can pass in angles in radians etc...You can change the default at runtime by calling the setArcParams function.

#define ARC_ANGLE_OFFSET -90

This number is an offset in degrees from the default position where the arc starts (representing value of 0). If you imagine a compass, then the default starting position is at the East point. Setting the value to -90 will move the starting point 90 degress counter-clockwise (so to the North point).

You can change the offset at runtime by calling the setAngleOffset function. The value provided in setAngleOffset argument is *in addition* to ARC_ANGLE_OFFSET value. So the total angle offset from the default East point is ARC_ANGLE_OFFSET+setAngleOffset value.


Creating Custom Fonts

You can create your own font files by using GLCDFontCreator2 tool. It generates .h files that can then be included in your sketch and the font can be set by the setFont function. The maximum height of a font can be 255 px. GLCDFontCreator2 tool requires Java and it is included in the tools folder or you can dowload it from here.
Here is a quick guide:

  1. Open GLCD Font Creator 2.
  2. From the menu select File->New Font.
  3. Select the Font, Size and Style you want to import in the Import Font group.
  4. Set the Start Index, that's the index from the character map. The first character (space) starts at index 32. The numbers start at index 48, upper-case characters at index 65, etc.
  5. Set the Char Count, that's the number of characters starting at the Start Index you want to have in your character set. So e.g. if you just need the numbers, set the Start Index to 48 and Char Count to 10. That will give you numbers 0-9 in your set.
  6. Set the Font Name. I advice to use maximum of 8 characters, no spaces.
  7. Click OK.
  8. From the menu select Export->Export Font.
  9. Provide a file name. No spaces and the same name as in step 6. Also add ".h" to your file name so you do not have to add it afterwards.
  10. When you click Save, the app starts to export but there is no visible progress. If you do not see the file immediately, just wait for it.
  11. Copy the .h file where your sketch is (or wherever you can find it).
  12. Add an include in your sketch, #include "name_from_step_9.h".
  13. Call tft.setFont(name_from_step_6) and tft.print to render the text.

Custom fonts on AVR (important!)

In order to use generated fonts on Uno, Mega,... you need to manually modify the generated .c file to make it succesfully compile. After you generate a .c file the array definition will look something like this:

static uint8_t Arial_14[] PROGMEM = {

If you do not change anything the compiler will complain with:

error: variable 'Arial_14' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

In order to fix it you need to add "const" so it will look like this:
static const uint8_t Arial_14[] PROGMEM = {

Here is a video of rendering a 255px-high font:

Demos

Loading images from an SD card

This is the SdFatTftBitmap example sketch demonstrating loading images from an SD card. The images were converted to RGB565 format using BMP24toILI565 tool (see the Tools folder). One image loads and displays in around 160ms using half speed for SD card SPI and half speed for Due SPI. I was getting distorted images when I tried to use the full speed for either of the SPIs.

This is the Arcs demo from the examples folder:

UTFT demo speed comparison

All the credits (and blame :) goes to TFTLCDCyg who ported the UTFT demo to ILI9341_due library. Both demos were run on Due at the max speed.

Here is a video of the demo powered by the UTFT library:

And here is the demo powered by the ILI9341_due library:

The source code for the ILI9341_due-fied demo can be found in the library's examples folder. Done with ILI9431_due v0.x version. The demo completes in around 1080ms with ILI9341_due v1.x version.

ILI9341_due_Buttons add-on library

Created by Graham Lawrence (aka ghlawrence2000). It's an add-on library which allows to easily add buttons to the UI. See his GitHub page for more information.

Here are videos of two of his example sketches:


ILI9341 functions

Functions summary (in alphabetical order)


Functions details

Fills/clears the whole screen.
void fillScreen(uint16_t color);
Arguments:
  • color - color to fill the screen with
  • Example:
    A screen filled with blue color.
    tft.fillScreen(ILI9341_BLUE);
    Draws a pixel.
    void drawPixel(int16_t x, int16_t y, uint16_t color);
    Arguments:
    • x - x-coordinate
    • y - y-coordinate
    • color - pixel color
    Example:
    A white pixel at position (100,100).
    tft.drawPixel(100, 100, ILI9341_WHITE);
    Draws a line.
    void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
    Arguments:
    • x0 - x-coordinate of the starting point
    • y0 - y-coordinate of the starting point
    • x1 - x-coordinate of the ending point
    • y1 - y-coordinate of the ending point
    • color - line color
    Example:
    A white line from point (100,100) to point (150,120)
    tft.drawLine(100, 100, 150, 120, ILI9341_WHITE);
    Draws a line defined by a start point and an angle. An offset from the start point can be defined.
    void drawLineByAngle(int16_t x, int16_t y, int16_t angle, uint16_t length, uint16_t color);
    void drawLineByAngle(int16_t x, int16_t y, int16_t angle, uint16_t start, uint16_t length, uint16_t color);
    Arguments:
    • x - x-coordinate of the starting point
    • y - y-coordinate of the starting point
    • angle - line angle
    • start - offset from the starting point (optional)
    • lenght - line lenght
    • color - line color
    Example:
    A white line from point (100,100) at 45 degree angle and of 50px length. A red line from point (100,100) at 90 degree angle starting 10px from the start point and with length of 50px.
    tft.drawLineByAngle(100, 100, 45, 50, ILI9341_WHITE);
    tft.drawLineByAngle(100, 100, 90, 10, 50, ILI9341_RED);
    Draws a horizontal line. Performance optimized version of drawLine for drawing horizontal lines.
    void drawFastHLine(int16_t x, int16_t y, uint16_t w, uint16_t color);
    Arguments:
    • x - x-coordinate of the starting point
    • y - y-coordinate of the starting point
    • w - line width (line is drawn from left to right)
    • color - line color
    Example:
    A white horizontal line from point (100,100) of 50px length.
    tft.drawFastHLine(100, 100, 50, ILI9341_WHITE);
    Draws a vertical line. Performance optimized version of drawLine for drawing vertical lines.
    void drawFastVLine(int16_t x, int16_t y, uint16_t h, uint16_t color);
    Arguments:
    • x - x-coordinate of the starting point
    • y - y-coordinate of the starting point
    • h - line height (line is drawn from top to bottom)
    • color - line color
    Example:
    A white vertical line from point (100,100) of 50px length.
    tft.drawFastVLine(100, 100, 50, ILI9341_WHITE);
    Draws a rectangle.
    void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
    Arguments:
    • x - x-coordinate of the rectangle top left corner
    • y - y-coordinate of the rectangle top left corner
    • w - rectangle width
    • h - rectangle height
    • color - rectangle color
    Example:
    A white rectangle from point (100,100) of 50px width and of 20px height.
    tft.drawRect(100, 100, 50, 20, ILI9341_WHITE);
    Draws a filled rectangle.
    void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
    Arguments:
    • x - x-coordinate of the rectangle top left corner
    • y - y-coordinate of the rectangle top left corner
    • w - rectangle width
    • h - rectangle height
    • color - rectangle fill color
    Example:
    A white filled rectangle from point (100,100) of 50px width and of 20px height.
    tft.fillRect(100, 100, 50, 20, ILI9341_WHITE);
    Draws a rectangle with rounded edges.
    void drawRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t radius, uint16_t color);
    Arguments:
    • x - x-coordinate of the rectangle top left corner
    • y - y-coordinate of the rectangle top left corner
    • w - rectangle width
    • h - rectangle height
    • radius - corner radius
    • color - rectangle color
    Example:
    A white rounded rectangle from point (100,100) of 50px width, 20px height and rounded edges of 7px radius.
    tft.drawRoundRect(100, 100, 50, 20, 7, ILI9341_WHITE);
    Draws a filled rectangle with rounded edges of specified radius from the specified position and of specified width and height.
    void fillRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t radius, uint16_t color);
    Arguments:
    • x - x-coordinate of the rectangle top left corner
    • y - y-coordinate of the rectangle top left corner
    • w - rectangle width
    • h - rectangle height
    • radius - corner radius
    • color - rectangle fill color
    Example:
    A white filled rounded rectangle from point (100,100) of 50px width, 20px height and rounded edges of 7px radius.
    tft.fillRoundRect(100, 100, 50, 20, 7, ILI9341_WHITE);
    Draws a circle.
    void drawCircle(int16_t x, int16_t y, int16_t r, uint16_t color);
    Arguments:
    • x - x-coordinate of the circle center
    • y - y-coordinate of the circle center
    • r - circle radius
    • color - circle color
    Example:
    A white circle with center at (100,100) and 20px radius.
    tft.drawCircle(100, 100, 20, ILI9341_WHITE);
    Draws a filled circle.
    void fillCircle(int16_t x, int16_t y, int16_t r, uint16_t color);
    Arguments:
    • x - x-coordinate of the circle center
    • y - y-coordinate of the circle center
    • r - circle radius
    • color - circle fill color
    Example:
    A white filled circle with center at (100,100) and 20px radius.
    tft.fillCircle(100, 100, 20, ILI9341_WHITE);
    Draws a filled arc. Can also be used to draw a pie.
    void fillArc(uint16_t x, uint16_t y, uint16_t radius, uint16_t thickness, float start, float end, uint16_t color);
    Arguments:
    • x - x-coordinate of the arc center
    • y - y-coordinate of the arc center
    • radius - arc radius
    • thickness - arc inward thickness
    • start - arc start angle
    • end - arc end angle
    • color - arc fill color
    Example:
    A white arc with center at (100,100), 20px radius, 5px thickness, starting at 45 degrees and ending at 180 degrees.
    A red pie with center at (160,100), 20px radius, starting at 45 degrees and ending at 270 degrees.
    tft.fillArc(100, 100, 20, 5, 45, 180, ILI9341_WHITE);
    tft.fillArc(160, 100, 20, 20, 45, 270, ILI9341_RED);
    Draws a triangle.
    void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
    Arguments:
    • x0 - x-coordinate of triangle 1st corner
    • y0 - y-coordinate of the triangle 1st corner
    • x1 - x-coordinate of triangle 2nd corner
    • y1 - y-coordinate of the triangle 2nd corner
    • x2 - x-coordinate of triangle 3rd corner
    • y2 - y-coordinate of the triangle 3rd corner
    • color - triangle color
    Example:
    A triangle defined by points (100,100) (80,130) (120,120).
    tft.drawTriangle(100, 100, 80, 130, 120, 120, ILI9341_WHITE);
    Draws a filled triangle.
    void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
    Arguments:
    • x0 - x-coordinate of triangle 1st corner
    • y0 - y-coordinate of the triangle 1st corner
    • x1 - x-coordinate of triangle 2nd corner
    • y1 - y-coordinate of the triangle 2nd corner
    • x2 - x-coordinate of triangle 3rd corner
    • y2 - y-coordinate of the triangle 3rd corner
    • color - triangle fill color
    Example:
    A filled triangle defined by points (100,100) (80,130) (120,120).
    tft.fillTriangle(100, 100, 80, 130, 120, 120, ILI9341_WHITE);
    Draws a monochrome image from a byte array. A background color can be specified, otherwise the background will be transparent.
    void drawBitmap(const uint8_t *bitmap, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
    void drawBitmap(const uint8_t *bitmap, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color, uint16_t bgcolor);
    Arguments:
    • bitmap - a pointer to a byte array (in progmem for AVR) holding pixel data
    • x - x-coordinate of the bitmaps's top left corner
    • y - y-coordinate of the bitmaps's top left corner
    • w - bitmap width (in pixels)
    • h - bitmap height (in pixels)
    • color - bitmap color (a color that will be used for drawing pixels where the corresponding bit in the array is set to 1)
    • bgColor - bitmap's background color (optional) (a color that will be used for drawing pixels where the corresponding bit in the array is set to 0). If not specified then the background is transparent.
      Example:
      Arduino logo with solid and transparent background (arrayMonochromeBitmap example sketch).
      const uint8_t arduLogo[] PROGMEM = {" // width 40, height 32
      B00000000, B00000000, B00000000, B00000000, B01111110,"
      ...
      B10001010, B00101111, B00011100, B11100100, B01001110
      };
      ...
      tft.drawBitmap(arduLogo, 110, 100, 40, 32, ILI9341_WHITE, ILI9341_DARKCYAN); // solid background
      tft.drawBitmap(arduLogo, 160, 100, 40, 32, ILI9341_DARKCYAN); // transparent background
      Draws an image from an array generated with BMP24toILI565Array tool.
      void drawImage(const uint16_t *colors, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
      Arguments:
      • colors - a pointer to an array (in progmem for AVR) holding pixel colors
      • x - x-coordinate of the image top left corner
      • y - y-coordinate of the image top left corner
      • w - image width, you can use the constant generated by BMP24toILI565Array tool which is called the same as the colors array with Width appended at the end (so if colors array name is myImage then the width of that image is in myImageWidth constant)
      • h - image height, you can use the constant generated by BMP24toILI565Array tool which is called the same as the colors array with Height appended at the end (so if colors array name is myImage then the height of that image is in myImageHeight constant)
      Example:
      3 icons from 3 arrays (arrayTftBitmap example sketch).
      #include "info.h
      #include "alert.h"
      #include "close.h"
      ...
      tft.drawImage(info, 100, 100, infoWidth, infoHeight);
      tft.drawImage(alert, 140, 100, alertWidth, alertHeight);
      tft.drawImage(close, 180, 100, closeWidth, closeHeight);
      Inverts display colors. Black becomes white, blue becomes yellow, etc.
      void invertDisplay(boolean i);
      Arguments:
      • i - if true colors are inverted, if false - colors are normal
      Example:
      Invert display colors.
      tft.invertDisplay(true);
      Sets the drawing window for pushPixel and pushPixels operations.
      void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
      Arguments:
      • x - x-coordinate of the upper left corner of the drawing window
      • y - y-coordinate of the upper left corner of the drawing window
      • w - x-coordinate of the bottom right corner of the drawing window
      • h - y-coordinate of the bottom right corner of the drawing window
      Example:
      Set the drawing window to a 20x30px region with top left corner at (100, 100).
      tft.setAddrWindow(100, 100, 119, 129);
      Same as setAddrWindow but uses width and height instead of bottom right corner coordinates.
      void setAddrWindowRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
      Arguments:
      • x - x-coordinate of the upper left corner of the drawing window
      • y - y-coordinate of the upper left corner of the drawing window
      • w - drawing window width
      • h - drawing window height
      Example:
      Set the drawing window to a 20x30px region with top left corner at (100, 100).
      tft.setAddrWindowRect(100, 100, 20, 30);
      Sends one 'pixel' to TFT. setAddrWindow needs to be called prior to calling pushColor to set the drawing region. If you want to draw just one pixel then it is easier to use the drawPixel function. If you want to draw more pixels within a rectangular area then combination of setAddrWindow and pushColor is a more efficient/faster than calling drawPixel multiple times. You set your drawing window with setAddrWindow once and then you call pushPixel multiple times to draw the pixels in left-to-right top-to-bottom order.
      void pushColor(uint16_t color);
      Arguments:
      • color - pixel color to draw
      Example:
      Draw a dashed line, 200px long, 3 pixels high. 3 pixels white, 2 pixels blue, 3 pixels white, 2 pixels blue,...
      tft.setAddrWindowRect(60, 100, 200, 3); // set the drawing window to a 200x3px rectangle
      for (byte y = 0; y < 3; y++) { // 3 lines
         for (byte x = 0; x < 40; x++) { // draw 5 pixels (3 white, 2 blue) fourty times (1 line)
            tft.pushColor(ILI9341_WHITE);
            tft.pushColor(ILI9341_WHITE);
            tft.pushColor(ILI9341_WHITE);
            tft.pushColor(ILI9341_BLUE);
            tft.pushColor(ILI9341_BLUE);
         }
      }
      Sends 'pixels' stored in an array to TFT. Similar to pushColor but instead of passing in one pixel, you pass in an array of pixels. setAddrWindow needs to be called prior to calling pushColors to set the drawing region. Using an array/buffer of pixels is even more efficient than calling pushColor mutiple times.
      void pushColors(const uint16_t *colors, uint16_t offset, uint32_t len);
      Arguments:
      • colors - a pointer to an array (in progmem for AVR) of pixels/colors
      • offset - offset from the beginning of the array
      • len - number of pixels to draw from the array
      Example:
      Draw a dashed line, 200px long, 3 pixels high. 3 pixels white, 2 pixels blue, 3 pixels white, 2 pixels blue,...
      const PROGMEM uint16_t pixels[] = { ILI9341_WHITE, ILI9341_WHITE, ILI9341_WHITE, ILI9341_BLUE, ILI9341_BLUE };
      ...
      tft.setAddrWindowRect(60, 100, 200, 3); // set the drawing window to a 200x3px rectangle
      for (byte y = 0; y < 3; y++) { // 3 lines
         for (byte x = 0; x < 40; x++) { // draw 5 pixels (3 white, 2 blue) fourty times (1 line)
            tft.pushColors(pixels, 0, 5);
         }
      }
      Sends 'pixels' stored in an array to TFT. Similar to pushColors that uses an array stored in progmem but this function takes in an array stored in RAM so you can modify the content of the array at runtime and draw from it.
      void pushColors(uint16_t *colors, uint16_t offset, uint32_t len);
      Arguments:
      • colors - a pointer to an array of pixels/colors
      • offset - offset from the beginning of the array
      • len - number of pixels to draw from the array
      Example:
      Draw a gradient line, 200px long. The gradient is generated at runtime.
      uint16_t pixels[200];
      ...
      for (byte x = 0; x < 200; x++) { // generate a simple grayscale gradient
         uint16_t color = (uint16_t)(255 * x) / 200;
         pixels[x] = tft.color565(color, color, color);
      }
      tft.setAddrWindowRect(60, 100, 200, 3); // set the drawing window to a 200x3px rectangle
      for (byte y = 0; y < 3; y++) { // 3 lines
         tft.pushColors(pixels, 0, 200); // draw the generated colors
      }
      Reads pixel color from TFT.
      uint16_t readPixel(int16_t x, int16_t y);
      Arguments:
      • x - x-coordinate of the pixel to read the color from
      • y - y-coordinate of the pixel to read the color from
      Returns - color of the pixel
      Example:
      Read color of a pixel at position (100,100).
      uint16_t color = tft.readPixel(100, 100);
      Sets display orientation.
      void setRotation(iliRotation r);
      Arguments:
      • r - can either be one of these enum values:
        • iliRotation0 - portrait mode
        • iliRotation90 - landscape mode
        • iliRotation180 - portrait mode (rotated by 180 degrees)
        • iliRotation270 - landscape mode (rotated by 180 degrees)
        or one of these numeric values:
        • 0 - portrait mode
        • 1 - landscape mode
        • 2 - portrait mode (rotated by 180 degrees)
        • 3 - landscape mode (rotated by 180 degrees)
      Example:
      Set rotation to landscape rotated by 180 degrees.
      tft.setRotation(iliRotation270); // using enum
      tft.setRotation(3); // using numeric value
      Turns pixel display on/off. With pixel display off the screen turns white. In the off mode, the output from Frame Memory is disabled and blank page inserted. This command makes no change of contents of frame memory.
      void display(boolean d);
      Arguments:
      • d - if true pixel display is on (normal mode), if false - pixel display is off (white screen)
      Example:
      Turn pixel display off.
      tft.display(false);
      Turns display idle mode on/off. In the idle mode, color depth is reduced. The primary and the secondary colors using MSB of each R, G and B in the Frame Memory, 8 color depth data is displayed.
      void idle(boolean i);
      Arguments:
      • i - if true TFT will be put into idle mode, if false TFT will be restored to normal mode (if it was in idle mode)
      Example:
      Put LCD into idle mode.
      tft.idle(true);
      Turns display sleep mode on/off. In the sleep mode the LCD module enters the minimum power consumption mode. The DC/DC converter is stopped, internal oscillator is stopped and panel scanning is stopped.
      void sleep(boolean s);
      Arguments:
      • s - if true TFT will be put into sleep mode, if false TFT will be restored to normal mode (if it was in sleep mode)
      Example:
      Put LCD into sleep mode.
      tft.sleep(true);
      Sets LCD power level.
      void setPowerLevel(pwrLevel p);
      Arguments:
      • p - can be one of these values:
        • pwrLevelNormal - normal mode - restores to normal mode (if it was in idle or sleep or both)
        • pwrLevelIdle - idle mode - same as calling idle(true)
        • pwrLevelSleep - sleep mode - same as calling sleep(true)
      Example:
      Put LCD into sleep mode.
      tft.setPowerLevel(pwrLevelSleep);
      Sets the SPI clock divider. That changes the clock frequency/speed at which data are sent/received to/from LCD. The higher the divider the lower the clock frequency and the drawing speed. If you have issues like LCD not working at all (white screen) or graphical artifacts then try to increase the divider (or alternatively try to improve your connections between Arduino and LCD - use the shortest cables possible and prefer soldered connections over breadboard).
      void setSPIClockDivider(uint8_t divider);
      Arguments:
      • divider
        - for Arduino Due - any number between 1 and 255
        - for AVR (Uno, Mega,...) one of these values:
        • SPI_CLOCK_DIV2 - SPI clock frequency is set to (CPU frequency / 2)
        • SPI_CLOCK_DIV4 - SPI clock frequency is set to (CPU frequency / 4)
        • SPI_CLOCK_DIV8 - SPI clock frequency is set to (CPU frequency / 8)
        • SPI_CLOCK_DIV16 - SPI clock frequency is set to (CPU frequency / 16)
        • SPI_CLOCK_DIV32 - SPI clock frequency is set to (CPU frequency / 32)
        • SPI_CLOCK_DIV64 - SPI clock frequency is set to (CPU frequency / 64)
        • SPI_CLOCK_DIV128 - SPI clock frequency is set to (CPU frequency / 128)
      Example:
      SPI clock frequency set to approx. 8 MHz.
      tft.setSPIClockDivider(10); // for Arduino Due 84MHz/10 = 8.4MHz
      tft.setSPIClockDivider(SPI_CLOCK_DIV2); // for Arduino Uno, Mega,... 16MHz/2 = 8MHz
      Sets the offset in degrees from the default position (set by ARC_ANGLE_OFFSET in ILI9341_due_config.h) where the arc will start (representing arc angle of 0 degrees). If you imagine a compass then the default starting position is at the North point (the arc will start from the top). Setting the offset to 90 degrees will move the starting point 90 degress clockwise so to the East point (the arc will start from the right side), etc.
      void setAngleOffset(int16_t angleOffset);
      Arguments:
      • angleOffset - clockwise offset in degrees from the default start point (North point). Can be a negative number which will offset angle's 0 degree position counter-clockwise from the default start point.
      Example:
      Set the red arc angle start point to West.
      Set the yellow arc angle start point to 45 degrees clockwise from North.
      Set the green arc angle start point to default.
      tft.setAngleOffset(-90);
      tft.fillArc(110, 100, 20, 10, 0, 195, ILI9341_RED);
      tft.setAngleOffset(45);
      tft.fillArc(160, 100, 20, 10, 0, 195, ILI9341_YELLOW);
      tft.setAngleOffset(0);
      tft.fillArc(210, 100, 20, 10, 0, 195, ILI9341_GREEN);
      Sets parameters for drawing arcs. For now it has only one param to set.
      void setArcParams(float arcAngleMax);
      Arguments:
      • arcAngleMax - sets the max value corresponding to 360 degrees. By default it is set to value defined by ARC_ANGLE_MAX in ILI9341_due_config.h which is 360. You can set it to any float value, so for example if you set it to 1.0 (which will represent the max angle of 360) then calling fillArc with startAngle of 0 and endAngle of 0.5 will get you a half circle.
      Example:
      Set the max angle to 100 so we can draw arcs using percentages. Then draw an arc with an 'angle' of 25% which will draw quarter of a circle.
      tft.setArcParams(100); // set arc max value to 100
      tft.fillArc(160, 120, 50, 10, 0, 25, ILI9341_WHITE); // draw 25% of a circle
      Sets the area for drawing the text.
      void setTextArea(gTextArea area);
      Arguments:
      • area - area for drawing the text
      Example:
      Draw strings into 2 separate areas.
      #include "fonts\Arial_bold_14.h"
      gTextArea titleArea{ 10, 10, 300, 40 }; // define a 300px wide and 40px high title area
      gTextArea descriptionArea{ 10, 60, 300, 170 }; // define a 300px wide and 170px high description area
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKBLUE);
      ...
      tft.setTextArea(titleArea);
      tft.clearTextArea(ILI9341_LIGHTBLUE); // just to see where the area is
      tft.print("My Title");
      tft.setTextArea(descriptionArea);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.print("My Description");
      Sets the area for drawing the text.
      void setTextArea(int16_t x, int16_t y, int16_t w, int16_t h);
      Arguments:
      • x - x-coordinate of area upper left corner
      • y - y-coordinate of area upper left corner
      • w - area width
      • h - area height
      Example:
      Draw strings into 2 separate areas.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKBLUE);
      ...
      tft.setTextArea(10, 10, 300, 40);
      tft.clearTextArea(ILI9341_LIGHTBLUE); // just to see where the area is
      tft.print("My Title");
      tft.setTextArea(10, 60, 300, 170);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.print("My Description");
      Sets the area for drawing the text.
      void setTextArea(int16_t x, int16_t y, int16_t columns, int16_t rows, gTextFont font);
      Arguments:
      • x - x-coordinate of area upper left corner
      • y - y-coordinate of area upper left corner
      • columns - area width in number of columns (the width of the widest character is used to calculate the area width)
      • rows - area height in number of rows (the font height is used to calculate area height
      • font - font to be used to calculate the area size
      Example:
      Draw strings into 2 separate areas.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKBLUE);
      ...
      tft.setTextArea(10, 10, 26, 2, Arial_bold_14); // 26 characters wide and 2 characters high area
      tft.clearTextArea(ILI9341_LIGHTBLUE); // just to see where the area is
      tft.print("My Title");
      tft.setTextArea(10, 60, 26, 7, Arial_bold_14); // 26 characters wide and 7 characters high area
      tft.clearTextArea(ILI9341_LIGHTBLUE); // just to see where the area is
      tft.print("My Description");
      Gets the current text area.
      gTextArea getTextArea();
      Example:
      Get the current text area.
      gTextArea textArea = tft.getTextArea('i');
      Clears the currently set text area with the currently set text background color.
      void clearTextArea();
      Arguments:
      Example:
      Clear 2 text areas (text background color will be used).
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKBLUE);
      tft.setTextArea(titleArea);
      tft.clearTextArea(); // clear the title area with dark blue color
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGRAY);
      tft.setTextArea(descriptionArea);
      tft.clearTextArea(); // clear the description area with dark gray color
      Clears the text area with the currently set text background color.
      void clearTextArea(gTextArea area);
      Arguments:
      • area - text area to clear
      Example:
      Clear 2 text areas (text background color will be used).
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKBLUE);
      tft.clearTextArea(titleArea); // clear the title area with dark blue color
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKGRAY);
      tft.clearTextArea(descriptionArea); // clear the description area with dark gray color
      Clears the currently set text area.
      void clearTextArea(uint16_t color);
      Arguments:
      • color - color to clear with
      Example:
      Clear 2 text areas.
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setTextArea(titleArea);
      tft.clearTextArea(ILI9341_LIGHTBLUE); // clear the title area with light blue color
      tft.setTextArea(descriptionArea);
      tft.clearTextArea(ILI9341_LIGHTGREEN); // clear the description area with light green color
      Clears the text area.
      void clearTextArea(gTextArea area, uint16_t color);
      Arguments:
      • area - text area to clear
      • color - color to clear with
      Example:
      Clear 2 text areas.
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.clearTextArea(titleArea, ILI9341_LIGHTBLUE); // clear the title area with light blue color
      tft.clearTextArea(descriptionArea, ILI9341_LIGHTGREEN); // clear the description area with light blue color
      Sets the font to use for text rendering. See the Creating Custom Fonts section.
      void setFont(gTextFont font);
      Arguments:
      • font - font to use
      Example:
      Set Arial bold font for the header and regular one for the description.
      #include "fonts\Arial14.h"
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setTextColor(ILI9341_WHITE, ILI9341_DARKBLUE);

      tft.setTextArea(titleArea);
      tft.setFont(Arial_bold_14);
      tft.print("My Title");

      tft.setTextArea(descriptionArea);
      tft.setFont(Arial14);
      tft.print("My Description");
      Gets the current font height.
      uint8_t getFontHeight();
      Example:
      Get the current font height.
      uint8_t fontHeight = tft.getFontHeight();
      Gets the font height.
      uint8_t getFontHeight(gTextFont font);
      Arguments:
      • font - font to get the height of
      Example:
      Get height of the SystemFont5x7 font. Will return number 7.
      uint8_t fontHeight = tft.getFontHeight(SystemFont5x7);
      Gets the width of a character in the current font set and with the current text scale.
      uint16_t getCharWidth(uint8_t c);
      Arguments:
      • c - character to get the width of
      Example:
      Get width of the 'i' character.
      uint16_t charWidth = tft.getCharWidth('i');
      Gets the width of a character.
      uint16_t getCharWidth(uint8_t c, gTextFont font, uint8_t textScale);
      Arguments:
      • c - character to get the width of
      • font - font to use for the width calculation
      • textScale - text scale to use for the width calculation
      Example:
      Get width of the 'i' character in SystemFont5x7 font set and with text scale of 2.
      uint16_t charWidth = tft.getCharWidth('i', SystemFont5x7, 2);
      Sets the text foreground color.
      void setTextColor(uint16_t color);
      Arguments:
      • color - text color to use
      Example:
      Set red color for the header and green color for the description. If the background color was not previously set then black will be used.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setFont(Arial_bold_14);

      tft.setTextArea(titleArea);
      tft.setTextColor(ILI9341_RED);
      tft.print("My Title");

      tft.setTextArea(descriptionArea);
      tft.setTextColor(ILI9341_LIME);
      tft.print("My Description");
      Sets the text foreground color.
      void setTextColor(uint8_t R, uint8_t G, uint8_t B);
      Arguments:
      • R - red
      • G - green
      • B - blue
      Example:
      Set red color for the header and green color for the description. If the background color was not previously set then black will be used.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setFont(Arial_bold_14);

      tft.setTextArea(titleArea);
      tft.setTextColor(255, 0, 0);
      tft.print("My Title");

      tft.setTextArea(descriptionArea);
      tft.setTextColor(0, 255, 0);
      tft.print("My Description");
      Sets the text foreground and background color.
      void setTextColor(uint16_t color, uint16_t backgroundColor);
      Arguments:
      • color - text foreground color
      • backgroundColor - text bacground color
      Example:
      Set red foreground color, dark red background color for the header and green foreground color, blue background color for the description.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setFont(Arial_bold_14);

      tft.setTextArea(titleArea);
      tft.setTextColor(ILI9341_RED, ILI9341_DARKRED);
      tft.print("My Title");

      tft.setTextArea(descriptionArea);
      tft.setTextColor(ILI9341_LIME, ILI9341_BLUE);
      tft.print("My Description");
      Sets the text foreground color.
      void setTextColor(uint8_t R, uint8_t G, uint8_t B, uint8_t bgR, uint8_t bgG, uint8_t bgB);
      Arguments:
      • R - foreground red
      • G - foreground green
      • B - foreground blue
      • bgR - background red
      • bgG - background green
      • bgB - background blue
      Example:
      Set red foreground color, dark red background color for the header and green foreground color, blue background color for the description.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea titleArea{ 10, 10, 300, 40 };
      gTextArea descriptionArea{ 10, 60, 300, 170 };
      ...
      tft.setFont(Arial_bold_14);

      tft.setTextArea(titleArea);
      tft.setTextColor(255, 0, 0, 127, 0, 0);
      tft.print("My Title");

      tft.setTextArea(descriptionArea);
      tft.setTextColor(0, 255, 0, 0, 0, 255);
      tft.print("My Description");
      Gets the current text foreground color.
      uint16_t getTextColor();
      Example:
      Get the current text color.
      uint16_t textColor = tft.getTextColor();
      Gets the current text background color.
      uint16_t getTextBackgroundColor();
      Example:
      Get the current text background color.
      uint16_t textBgColor = tft.getTextBackgroundColor();
      Sets the spacing between characters. The default is 2px (DEFAULT_LETTER_SPACING).
      void setTextLetterSpacing(uint8_t letterSpacing);
      Arguments:
      • letterSpacing - the distance in pixels between characters
      Example:
      Set different letter spacings.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea textArea{ 10, 10, 300, 200 };
      ...
      tft.setFont(Arial_bold_14);

      tft.setTextArea(textArea);
      tft.setTextColor(ILI9341_WHITE, ILI9341_BLUE);
      tft.setTextLetterSpacing(0);
      tft.print("Letter Spacing 0\n");
      tft.setTextLetterSpacing(1);
      tft.print("Letter Spacing 1\n");
      tft.setTextLetterSpacing(2);
      tft.print("Letter Spacing 2\n");
      tft.setTextLetterSpacing(3);
      tft.print("Letter Spacing 3\n");
      tft.setTextLetterSpacing(4);
      tft.print("Letter Spacing 4\n");
      tft.setTextLetterSpacing(5);
      tft.print("Letter Spacing 5\n");
      tft.setTextLetterSpacing(6);
      tft.print("Letter Spacing 6\n");
      tft.setTextLetterSpacing(7);
      tft.print("Letter Spacing 7\n");
      tft.setTextLetterSpacing(8);
      tft.print("Letter Spacing 8\n");
      tft.setTextLetterSpacing(9);
      tft.print("Letter Spacing 9\n");
      tft.setTextLetterSpacing(10);
      tft.print("Letter Spacing 10");
      Gets the current spacing between characters.
      uint8_t getTextLetterSpacing();
      Example:
      Get the letter spacing.
      uint8_t letterSpacing = tft.getTextLetterSpacing();
      Sets the spacing between lines. The default is 0px (DEFAULT_LINE_SPACING).
      void setTextLineSpacing(uint8_t lineSpacing);
      Arguments:
      • lineSpacing - the distance in pixels between lines
      Example:
      Set different line spacings.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea textArea{ 10, 10, 300, 200 };
      ...
      tft.setFont(Arial_bold_14);

      tft.setTextArea(textArea);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);
      tft.setTextLineSpacing(0);
      tft.print("Line Spacing 0\n");
      tft.setTextLineSpacing(1);
      tft.print("Line Spacing 1\n");
      tft.setTextLineSpacing(2);
      tft.print("Line Spacing 2\n");
      tft.setTextLineSpacing(3);
      tft.print("Line Spacing 3\n");
      tft.setTextLineSpacing(4);
      tft.print("Line Spacing 4\n");
      tft.setTextLineSpacing(5);
      tft.print("Line Spacing 5\n");
      tft.setTextLineSpacing(6);
      tft.print("Line Spacing 6\n");
      tft.setTextLineSpacing(7);
      tft.print("Line Spacing 7\n");
      tft.setTextLineSpacing(8);
      tft.print("Line Spacing 8\n");
      tft.setTextLineSpacing(9);
      tft.print("Line Spacing 9\n");
      tft.setTextLineSpacing(10);
      tft.print("Line Spacing 10\n");
      tft.print("Line Spacing end");
      Gets the current spacing between lines.
      uint8_t getTextLineSpacing();
      Example:
      Get the line spacing.
      uint8_t lineSpacing = tft.getTextLineSpacing();
      Sets solid or transparent font background when rendering text.
      void setFontMode(gTextFontMode fontMode);
      Arguments:
      • fontMode - can be one of these enum values:
        • gTextFontModeTransparent - transparent font background
        • gTextFontModeSolid - solid font background (default)
      Example:
      Draw some random colored background and text with transparent and solid backgrounds.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea textArea{ 10, 10, 300, 200 };
      ...
      for (uint32_t i = 0; i < 320; i += 20){
        for (uint32_t j = 0; j < 240; j += 20){
          tft.fillRect(i, j, 20, 20, random(0,65535));
        }
      }

      tft.setFont(Arial_bold_14);
      tft.setTextArea(textArea);
      tft.setTextColor(ILI9341_WHITE, ILI9341_GREEN);

      tft.setFontMode(gTextFontModeTransparent);
      tft.print("gTextFontModeTransparent\n\n");

      tft.setFontMode(gTextFontModeSolid);
      tft.print("gTextFontModeSolid");
      Gets the current font mode. Returns one of the enum values - gTextFontModeSolid or gTextFontModeTransparent
      gTextFontMode getFontMode();
      Example:
      Get the current font mode.
      gTextFontMode fontMode = tft.getFontMode();
      Sets text scaling.
      void setTextScale(uint8_t textScale);
      Arguments:
      • textScale - text scale multiplier
      Example:
      Draw text at different scales.
      #include "fonts\Arial_bold_14.h"
      ...
      gTextArea textArea{ 10, 10, 300, 200 };
      ...

      tft.setFont(Arial_bold_14);
      tft.setTextArea(textArea);
      tft.setTextColor(ILI9341_WHITE, ILI9341_BLUE);

      tft.setTextScale(1);
      tft.print("Text Scale 1\n");
      tft.setTextScale(2);
      tft.print("Text Scale 2\n");
      tft.setTextScale(3);
      tft.print("Text Scale 3\n");
      tft.setTextScale(4);
      tft.print("Text Scale 4\n");
      tft.setTextScale(5);
      tft.print("Text Scale 5");
      Gets the current font mode. Returns one of the enum values - gTextFontModeSolid or gTextFontModeTransparent
      uint8_t getTextScale();
      Example:
      Get the current text scale.
      uint8_t scale = tft.getTextScale();
      Sets the text cursor coordinates. The coordinates are relative to the current text area upper left corner.
      void cursorToXY(int16_t x, int16_t y)
      Arguments:
      • x - x-coordinate of the string top left corner
      • y - y-coordinate of the string top left corner
      Example:
      Print texts at different locations.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.cursorToXY(10, 10);
      tft.print("String 1");

      String str2 = "String 2";
      tft.cursorToXY(30, 30);
      tft.print(str2);

      tft.cursorToXY(50, 50);
      tft.print(F("String 3"));
      Sets the text cursor column and row at which the text rendering should start. Columns and rows are numbered from 0 (so the first column is 0, second column is 1, etc.) and are relative to the current text area. The width of the column matches the width of the widest character in the font set.
      void cursorTo(uint8_t column, uint8_t row);
      Arguments:
      • column - the column where the text cursor will be set
      • row - the row where the text cursor will be set
      Sets the text cursor column on the current row. Columns are numbered from 0 (so the first column is 0, second column is 1, etc.) and are relative to the current text area. The width of the column matches the width of the widest character in the font set.
      void cursorTo(uint8_t column);
      Arguments:
      • column - the column where the text cursor will be set
      Prints a string. The coordinates are relative to the current text area upper left corner.
      void printAt(const char *str, int16_t x, int16_t y);
      void printAt(const String &str, int16_t x, int16_t y);
      void printAt(const __FlashStringHelper* str, int16_t x, int16_t y);
      Arguments:
      • str - string to print
      • x - x-coordinate of the string top left corner
      • y - y-coordinate of the string top left corner
      Example:
      Print texts at different locations.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAt("String 1", 10, 10);

      String str2 = "String 2";
      tft.printAt(str2, 30, 30);

      tft.printAt(F("String 3"), 50, 50);
      Prints a string and erases areas between the beginning of the line and the string or between the string and the end of line or both.
      void printAt(const char *str, int16_t x, int16_t y, gTextEraseLine eraseLine);
      void printAt(const String &str, int16_t x, int16_t y, gTextEraseLine eraseLine);
      void printAt(const __FlashStringHelper *str, int16_t x, int16_t y, gTextEraseLine eraseLine);
      Arguments:
      • str - string to print
      • x - x-coordinate (relative to text area) of the string top left corner
      • y - y-coordinate (relative to text area) of the string top left corner
      • eraseLine - can be one of these enum values:
        • gTextEraseFromBOL - erases from the beginning of line
        • gTextEraseToEOL - erases to the end of line
        • gTextEraseFullLine - erases the whole line
      Example:
      Print text with different line erase.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAt("EraseFromBOL", 100, 10, gTextEraseFromBOL);

      String str2 = "EraseToEOL";
      tft.printAt(str2, 100, 30, gTextEraseToEOL);

      tft.printAt(F("EraseFullLine"), 100, 50, gTextEraseFullLine);
      Prints a string and erases areas on both sides of the string.
      void printAt(const char *str, int16_t x, int16_t y, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      void printAt(const String &str, int16_t x, int16_t y, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      void printAt(const __FlashStringHelper *str, int16_t x, int16_t y, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      Arguments:
      • str - string to print
      • x - x-coordinate (relative to text area) of the string top left corner
      • y - y-coordinate (relative to text area) of the string top left corner
      • pixelsClearedOnLeft - width in pixels to be cleared on the string left side
      • pixelsClearedOnRight - width in pixels to be cleared on the string right side
      Example:
      Print text with different line erase.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAt("<- 10px on left, 10px on right ->", 30, 10, 10, 10);

      String str2 = "<- 2px on left, 20px on right ->";
      tft.printAt(str2, 30, 30, 2, 20);

      tft.printAt(F("<- 30px on left, 5px on right ->"), 30, 50, 30, 5);
      Prints a string which is positioned relatively to its pivot.
      void printAtPivoted(const char *str, int16_t x, int16_t y, gTextPivot pivot);
      void printAtPivoted(const String &str, int16_t x, int16_t y, gTextPivot pivot);
      void printAtPivoted(const __FlashStringHelper *str, int16_t x, int16_t y, gTextPivot pivot);
      Arguments:
      • str - string to print
      • x - x-coordinate (relative to text area) of the target pivot location
      • y - y-coordinate (relative to text area) of the target pivot location
      • pivot - string's pivot location. Can be one of these enum values:
        • gTextPivotTopLeft - the pivot is in the top left corner of the string
        • gTextPivotTopCenter - the pivot is in the top center of the string
        • gTextPivotTopRight - the pivot is in the top right corner of the string
        • gTextPivotMiddleLeft - the pivot is in the middle left of the string
        • gTextPivotMiddleCenter - the pivot is in the middle center of the string
        • gTextPivotMiddleRight - the pivot is in the top middle right of the string
        • gTextPivotBottomLeft - the pivot is in the bottom left corner of the string
        • gTextPivotBottomCenter - the pivot is in the bottom center of the string
        • gTextPivotBottomRight - the pivot is in the bottom right corner of the string
      Example:
      Print text at the same x-coordinate but with different pivots. You define which pivot to use and that pivot is then moved (together with the string) to (x,y) location.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAtPivoted("PivotTopLeft", 150, 10, gTextPivotTopLeft);
      tft.printAtPivoted("PivotTopCenter", 150, 30, gTextPivotTopCenter);
      tft.printAtPivoted("PivotTopRight", 150, 50, gTextPivotTopRight);
      Prints a text area aligned string.
      void printAligned(const char *str, gTextAlign align);
      void printAligned(const String &str, gTextAlign align);
      void printAligned(const __FlashStringHelper *str, gTextAlign align);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      Example:
      Print text with different alignments.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAligned("TopLeft", gTextAlignTopLeft);
      tft.printAligned("TopCenter", gTextAlignTopCenter);
      tft.printAligned("TopRight", gTextAlignTopRight);
      tft.printAligned("MiddleLeft", gTextAlignMiddleLeft);
      tft.printAligned("MiddleCenter", gTextAlignMiddleCenter);
      tft.printAligned("MiddleRight", gTextAlignMiddleRight);
      tft.printAligned("BottomLeft", gTextAlignBottomLeft);
      tft.printAligned("BottomCenter", gTextAlignBottomCenter);
      tft.printAligned("BottomRight", gTextAlignBottomRight);
      Prints a text area aligned string and erases areas between the beginning of the line and the string or between the string and the end of line or both.
      void printAligned(const char *str, gTextAlign align, gTextEraseLine eraseLine);
      void printAligned(const String &str, gTextAlign align, gTextEraseLine eraseLine);
      void printAligned(const __FlashStringHelper *str, gTextAlign align, gTextEraseLine eraseLine);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • eraseLine - can be one of these enum values:
        • gTextEraseFromBOL - erases from the beginning of line
        • gTextEraseToEOL - erases to the end of line
        • gTextEraseFullLine - erases the whole line
      Example:
      Print text with different alignments.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAligned("EraseFromBOL", gTextAlignTopCenter, gTextEraseFromBOL);
      tft.printAligned("EraseToEOL", gTextAlignMiddleCenter, gTextEraseToEOL);
      tft.printAligned("EraseFullLine", gTextAlignBottomCenter, gTextEraseFullLine);
      Prints a text area aligned string and erases areas on both sides of the string.
      void printAligned(const char *str, gTextAlign align, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      void printAligned(const String &str, gTextAlign align, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      void printAligned(const __FlashStringHelper *str, gTextAlign align, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • pixelsClearedOnLeft - width in pixels to be cleared on the string left side
      • pixelsClearedOnRight - width in pixels to be cleared on the string right side
      Example:
      Print text with different alignments and different erased areas on both sides of the string.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAligned("<- 10px on left, 10px on right ->", gTextAlignTopLeft, 10, 10);
      tft.printAligned("<- 2px on left, 20px on right ->", gTextAlignMiddleCenter, 2, 20);
      tft.printAligned("<- 30px on left, 5px on right ->", gTextAlignBottomRight, 30, 5);
      Prints a text area aligned string with offset.
      void printAlignedOffseted(const char *str, gTextAlign align, uint16_t offsetX, uint16_t offsetY);
      void printAlignedOffseted(const String &str, gTextAlign align, uint16_t offsetX, uint16_t offsetY);
      void printAlignedOffseted(const __FlashStringHelper *str, gTextAlign align, uint16_t offsetX, uint16_t offsetY);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • offsetX - string offset in x-axis
      • offsetY - string offset in y-axis
      Example:
      Print text aligned in the middle with different offsets.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAlignedOffseted("Middle", gTextAlignMiddleCenter, 0, 0); // no actual offset
      tft.printAlignedOffseted("-90px offset-x", gTextAlignMiddleCenter, -90, 0);
      tft.printAlignedOffseted("+90px offset-x", gTextAlignMiddleCenter, 90, 0);
      tft.printAlignedOffseted("-30px offset-y", gTextAlignMiddleCenter, 0, -30);
      tft.printAlignedOffseted("+30px offset-y", gTextAlignMiddleCenter, 0, 30);
      Prints a text area aligned string with offset and erases areas between the beginning of the line and the text or between the end of string and the end of line or both.
      void printAlignedOffseted(const char *str, gTextAlign align, uint16_t offsetX, uint16_t offsetY, gTextEraseLine eraseLine);
      void printAlignedOffseted(const String &str, gTextAlign align, uint16_t offsetX, uint16_t offsetY, gTextEraseLine eraseLine);
      void printAlignedOffseted(const __FlashStringHelper *str, gTextAlign align, uint16_t offsetX, uint16_t offsetY, gTextEraseLine eraseLine);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • offsetX - string offset in x-axis
      • offsetY - string offset in y-axis
      • eraseLine - can be one of these enum values:
        • gTextEraseFromBOL - erases from the beginning of line
        • gTextEraseToEOL - erases to the end of line
        • gTextEraseFullLine - erases the whole line
      Example:
      Print text aligned in the middle with different offsets and different line erase.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAlignedOffseted("-30px offset-y, EraseFromBOL", gTextAlignMiddleCenter, 0, -30, gTextEraseFromBOL);
      tft.printAlignedOffseted("Middle, EraseFullLine", gTextAlignMiddleCenter, 0, 0, gTextEraseFullLine);
      tft.printAlignedOffseted("+30px offset-y, EraseToEOL", gTextAlignMiddleCenter, 0, 30, gTextEraseToEOL);
      Prints a text area aligned string with offset and erases areas on both sides of the string.
      void printAlignedOffseted(const char *str, gTextAlign align, uint16_t offsetX, uint16_t offsetY, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);

      void printAlignedOffseted(const String &str, gTextAlign align, uint16_t offsetX, uint16_t offsetY, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);

      void printAlignedOffseted(const __FlashStringHelper *str, gTextAlign align, uint16_t offsetX, uint16_t offsetY, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • offsetX - string offset in x-axis
      • offsetY - string offset in y-axis
      • pixelsClearedOnLeft - width in pixels to be cleared on the string left side
      • pixelsClearedOnRight - width in pixels to be cleared on the string right side
      Example:
      Print text aligned in the middle with different offsets and different line erase.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAlignedOffseted("<- 10px, -30px offset-y , 10px ->", gTextAlignMiddleCenter, 0, -30, 10, 10);
      tft.printAlignedOffseted("<- 2px, Middle, 20px ->", gTextAlignMiddleCenter, 0, 0, 2, 20);
      tft.printAlignedOffseted("<- 30px, +30px offset-y, 5px ->", gTextAlignMiddleCenter, 0, 30, 30, 5);
      Prints a pivot based text area aligned string with offset.
      void printAlignedPivotedOffseted(const char *str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY);

      void printAlignedPivotedOffseted(const String &str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY);

      void printAlignedPivotedOffseted(const __FlashStringHelper *str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • pivot - string's pivot location. Can be one of these enum values:
        • gTextPivotTopLeft - the pivot is in the top left corner of the string
        • gTextPivotTopCenter - the pivot is in the top center of the string
        • gTextPivotTopRight - the pivot is in the top right corner of the string
        • gTextPivotMiddleLeft - the pivot is in the middle left of the string
        • gTextPivotMiddleCenter - the pivot is in the middle center of the string
        • gTextPivotMiddleRight - the pivot is in the top middle right of the string
        • gTextPivotBottomLeft - the pivot is in the bottom left corner of the string
        • gTextPivotBottomCenter - the pivot is in the bottom center of the string
        • gTextPivotBottomRight - the pivot is in the bottom right corner of the string
    • offsetX - string offset in x-axis
    • offsetY - string offset in y-axis
    • Example:
      Print text with its middle right pivot aligned to bottom right corner of the text area and offset it by 5px to the left.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAlignedPivotedOffseted("Text middle line aligned to bottom", gTextAlignBottomRight, gTextPivotMiddleRight, -5, 0);
      Prints a pivot based text area aligned string with offset and erases areas between the beginning of the line and the string or between the string and the end of line or both.
      void printAlignedPivotedOffseted(const char *str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY, gTextEraseLine eraseLine);

      void printAlignedPivotedOffseted(const String &str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY, gTextEraseLine eraseLine);

      void printAlignedPivotedOffseted(const __FlashStringHelper *str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY, gTextEraseLine eraseLine);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • pivot - string's pivot location. Can be one of these enum values:
        • gTextPivotTopLeft - the pivot is in the top left corner of the string
        • gTextPivotTopCenter - the pivot is in the top center of the string
        • gTextPivotTopRight - the pivot is in the top right corner of the string
        • gTextPivotMiddleLeft - the pivot is in the middle left of the string
        • gTextPivotMiddleCenter - the pivot is in the middle center of the string
        • gTextPivotMiddleRight - the pivot is in the top middle right of the string
        • gTextPivotBottomLeft - the pivot is in the bottom left corner of the string
        • gTextPivotBottomCenter - the pivot is in the bottom center of the string
        • gTextPivotBottomRight - the pivot is in the bottom right corner of the string
    • offsetX - string offset in x-axis
    • offsetY - string offset in y-axis
    • eraseLine - can be one of these enum values:
      • gTextEraseFromBOL - erases from the beginning of line
      • gTextEraseToEOL - erases to the end of line
      • gTextEraseFullLine - erases the whole line
    • Example:
      Print text with its middle right pivot aligned to bottom right corner of the text area, offset it by 5px to the left and erase everything from the beginning of the line.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAlignedPivotedOffseted("Text middle line aligned to bottom", gTextAlignBottomRight, gTextPivotMiddleRight, -5, 0, gTextEraseFromBOL);
      Prints a pivot based text area aligned string with offset and erases areas between the beginning of the line and the string or between the string and the end of line or both.
      void printAlignedPivotedOffseted(const char *str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);

      void printAlignedPivotedOffseted(const String &str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);

      void printAlignedPivotedOffseted(const __FlashStringHelper *str, gTextAlign align, gTextPivot pivot, uint16_t offsetX, uint16_t offsetY, uint16_t pixelsClearedOnLeft, uint16_t pixelsClearedOnRight);
      Arguments:
      • str - string to print
      • align - alignment of string in respect to text area. Can be one of these values:
        • gTextAlignTopLeft - aligning to top left
        • gTextAlignTopCenter - aligning to top center
        • gTextAlignTopRight - aligning to top right
        • gTextAlignMiddleLeft - aligning to midlle left
        • gTextAlignMiddleCenter - aligning to midlle center
        • gTextAlignMiddleRight - aligning to midlle right
        • gTextAlignBottomLeft - aligning to bottom left
        • gTextAlignBottomCenter - aligning to bottom center
        • gTextAlignBottomRight - aligning to bottom right
      • pivot - string's pivot location. Can be one of these enum values:
        • gTextPivotTopLeft - the pivot is in the top left corner of the string
        • gTextPivotTopCenter - the pivot is in the top center of the string
        • gTextPivotTopRight - the pivot is in the top right corner of the string
        • gTextPivotMiddleLeft - the pivot is in the middle left of the string
        • gTextPivotMiddleCenter - the pivot is in the middle center of the string
        • gTextPivotMiddleRight - the pivot is in the top middle right of the string
        • gTextPivotBottomLeft - the pivot is in the bottom left corner of the string
        • gTextPivotBottomCenter - the pivot is in the bottom center of the string
        • gTextPivotBottomRight - the pivot is in the bottom right corner of the string
    • offsetX - string offset in x-axis
    • offsetY - string offset in y-axis
    • pixelsClearedOnLeft - width in pixels to be cleared on the string left side
    • pixelsClearedOnRight - width in pixels to be cleared on the string right side
    • Example:
      Print text with its middle right pivot aligned to bottom right corner of the text area, offset it by 5px to the left and erase 10px on the left side of the string and 5px on the right side of the string.
      #include "fonts\Arial_bold_14.h"
      ...
      tft.setFont(Arial_bold_14);
      tft.setTextArea(10, 10, 300, 200);
      tft.clearTextArea(ILI9341_LIGHTBLUE);
      tft.setTextColor(ILI9341_WHITE, ILI9341_NAVY);

      tft.printAlignedPivotedOffseted("Text middle line aligned to bottom", gTextAlignBottomRight, gTextPivotMiddleRight, -5, 0, 10, 5);
      Takes a screenshot of the whole display and outputs it to the console in the form of a text string that looks like this:
      ==== PIXEL DATA START ====
      0000000090606060001F000000011B606060002B0000000
      11060606000350000000107606060003D00000000FF6060
      60004500000000F86060600016000000001F60606000160
      ...
      0000000F26060600013000000002B606060001300000000
      EC6060600011000000001B7C7E7C000E000000000C60606
      06060002B000000011B606060001F00000001D1000050F0
      ==== PIXEL DATA END ====
      That text string (everything between PIXEL DATA START and PIXEL DATA END, so starting with 0000... and ending with ...50F0) can be then pasted in the ILIScreenshotViewer (from the Tools folder) which will convert it back to an image.
      Alternatively you can connect to Arduino from ILIScreenshotViewer and any time screenshotToConsole is called, ILIScreenshotViewer will automatically display the image so there is no need to copy/paste the text strings. Image can be saved in bmp, jpg or png format.
      If you are getting errors after you paste in the string or the image has artifacts then try to lower the SPI clock speed before calling screenshotToConsole.
      void screenshotToConsole();
      Example:
      Draw an icon and take a screenshot. Compile and upload the example. After that run ILIScreenshotViewer and connect the built-in console to Arduino. COM port is the same as for uploading sketches and Baud Rate should be set to 115200 (or whatever you set in Serial.begin(xxx)). After Arduino is reset (automatically or manually), a screenshot should appear in ILIScreenshotViewer. This example is from examples\iliScreenshotViewer folder.
      #include "alert.h"
      void setup() {
         Serial.begin(115200);
         tft.begin();
         tft.setRotation(iliRotation270); // landscape
         tft.fillScreen(ILI9341_BLACK);
         tft.drawImage(alert, 140, 100, alertWidth, alertHeight);
         // reduce the SPI clock speed if you get errors or image artifacts
         //tft.setSPIClockDivider(10); // for Due
         //tft.setSPIClockDivider(SPI_CLOCK_DIV8); // for Uno, Mega,...
         tft.screenshotToConsole();
      }
      Reads the status registers and outputs the settings to Serial.
      void getDisplayStatus();
      Example:
      Get display status.
      getDisplayStatus();

      Serial output:
      Display Power Mode: 0x9C
        Booster: On and working OK
        Idle Mode: Off
        Partial Mode: Off
        Sleep Mode: Off
        Display Normal Mode: On
        Display: On
      MADCTL Mode: 0x48
        Top to Bottom
        Right to Left
        Reverse Mode
        LCD Refresh Top to Bottom
        BGR
        LCD Refresh Left to Right
      Pixel Format: 0x5
        16 bits/pixel
      Image Format: 0x0
        Gamma curve 1
      Display Signal Mode: 0x0
        Tearing effect line: Off
        Tearing effect line: mode 1
        Horizontal sync: Off
        Vertical sync: Off
        Pixel clock: Off
        Data enable: Off
      Self Diagnostic: 0xC0
        Register Loading: working
        Functionality: working

      Contact

      If you want to ask me a question or just contact me, feel free to do so in the Arduino Forum.


      ------------------------------------------
      This is a library for the Adafruit ILI9341 display products
      This library works with the Adafruit 2.8" Touch Shield V2 (SPI)
        ----> http://www.adafruit.com/products/1651
      Check out the links above for our tutorials and wiring diagrams.
      These displays use SPI to communicate, 4 or 5 pins are required
      to interface (RST is optional).
      Adafruit invests time and resources providing this open source code,
      please support Adafruit and open-source hardware by purchasing
      products from Adafruit!
      Written by Limor Fried/Ladyada for Adafruit Industries.
      MIT license, all text above must be included in any redistribution