Example Code for Arduino-English Font Display
Last revision 2026/01/18
This article is a comprehensive guide to displaying English fonts on Arduino using the DFRobot GDL Library. It includes step-by-step instructions for hardware and software preparation, wiring diagrams, and sample code, targeting ESP32 and ESP8266 platforms.
Hardware Preparation
- FireBeetle ESP32-E (or similar) x 1
- 1.8Inch 128×160 TFT LCD Display with MicroSD Card Slot x1
- Wires
Software Preparation
- Arduino IDE
- DFRobot GDL Library
- About how to install the library?
- DFRobot_GDL API, click to learn more.
Wiring Diagram
The following figure shows two ways of connection: SPI and GDI.

Other Preparation Work
- For using GDI, please make sure your controller has GDI interface.
- It is recommended to use Arduino version 1.8.10 and above.
- If the SD card slot is not well connected, the initialization may fail, and it will succeed after unplugging and plugging again.
- Arduino UNO is not recommended for memory reasons.
- All the Demos of this product are stored in the file of DFRobot_GDL->ST7735_128x160-.
- Before burning the Demo, please open the corresponding substantiation function (DFRobot_ST7789_128x160_HW_SPI)

Sample Code
#include "DFRobot_GDL.h"
/*M0*/
#if defined ARDUINO_SAM_ZERO
#define TFT_DC 7
#define TFT_CS 5
#define TFT_RST 6
/*ESP32 ESP8266*/
#elif defined(ESP32)
#define TFT_DC D2
#define TFT_CS D6
#define TFT_RST D3
/*ESP8266*/
#elif defined(ESP8266)
#define TFT_DC D4
#define TFT_CS D6
#define TFT_RST D5
/* AVR series mainboard */
#else
#define TFT_DC 2
#define TFT_CS 3
#define TFT_RST 4
#endif
DFRobot_ST7735_128x160_HW_SPI screen(/*dc=*/TFT_DC,/*cs=*/TFT_CS,/*rst=*/TFT_RST);
/* M0 mainboard DMA transfer */
//DFRobot_ST7735_128x160_DMA_SPI screen(/*dc=*/TFT_DC,/*cs=*/TFT_CS,/*rst=*/TFT_RST);
void setup() {
Serial.begin(115200);
screen.begin();
}
void loop() {
screen.setTextSize(2);
screen.fillScreen(COLOR_RGB565_BLACK);
screen.setFont(&FreeMono12pt7b);
screen.setCursor(/*x=*/32,/*y=*/64);
screen.setTextColor(COLOR_RGB565_LGRAY);
screen.setTextWrap(true);
screen.print("DFRobot");
delay(500);
screen.fillScreen(COLOR_RGB565_BLACK);
screen.setFont(&FreeMonoBold12pt7b);
screen.setCursor(/*x=*/32,/*y=*/64);
screen.setTextColor(COLOR_RGB565_GREEN);
screen.setTextWrap(true);
screen.print("GDL");
delay(500);
screen.fillScreen(COLOR_RGB565_BLACK);
screen.setFont(&FreeMonoBoldOblique12pt7b);
screen.setCursor(/*x=*/32,/*y=*/64);
screen.setTextColor(COLOR_RGB565_RED);
screen.setTextWrap(true);
screen.print("fonts test");
delay(500);
screen.fillScreen(COLOR_RGB565_BLACK);
screen.setFont(&FreeMonoOblique12pt7b);
screen.setCursor(/*x=*/32,/*y=*/64);
screen.setTextColor(COLOR_RGB565_BLUE);
screen.setTextWrap(true);
screen.print("hello,world!");
delay(500);
}
Result

Was this article helpful?
