The Adafruit_GFX library for Arduino provides a common syntax and set of graphics functions for all of our LCD and OLED displays and LED matrices. This allows Arduino sketches to easily be adapted between display types with minimal fuss…and any new features, performance improvements and bug fixes will immediately apply across our complete offering of color displays.

Adafruit_GFX always works together with an additional library unique to each specific display type. These can be installed using the Arduino Library Manager. From the Arduino “Sketch” menu, select “Include Library,” then “Manage Libraries…”

In the Arduino Library Manager window, search for a display’s driver type (e.g. “SSD1325”) and the appropriate Adafruit library can be found in the results. Required companion libraries (“dependencies,” like Adafruit_GFX or Adafruit_BusIO) now get installed automatically. If using an older version of the Arduino IDE, you’ll have to search for and install those additional libraries manually.

Some of the libraries that operate alongside Adafruit_GFX include:

And many others, except for some very early “retired” products. Remember, just search for the display driver type in the Arduino Library manager, install, and the rest is automatic now.

The libraries are written in C++ for Arduino but could easily be ported to any microcontroller by rewriting the low-level pin access functions.

The Old Way

Much older versions of the Arduino IDE software require installing libraries manually; the Arduino Library Manager did not yet exist. If using an early version of the Arduino software, this might be a good time to upgrade. Otherwise, this tutorial explains how to install and use Arduino libraries. Here are links to download the GFX and BusIO libraries directly (use the links above to get the corresponding display-specific libraries):

Accessing GFX Functions

Any Arduino sketch using Adafruit_GFX needs to #include two libraries. You’ll see this in most examples, near the top of the code. The first, Adafruit_GFX.h, declares a common set of graphics functions such as shapes and colors (explained on subsequent pages). The second completely depends on whatever display you’re using…it might be Adafruit_ST7789.h (for certain color displays), Adafruit_SSD1306.h (for certain monochrome OLEDs) or something else…the guide or product page for the display will tell you which library to install. The very top of a sketch then usually resembles something like this:

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789

This guide was first published on Jul 29, 2012. It was last updated on Jun 14, 2024.

This page (Overview) was last updated on Mar 08, 2024.

Text editor powered by tinymce.