Example Code for Arduino-GDI Display interface
Last revision 2026/02/05
The article guides users on setting up an Arduino-GDI display interface, providing example code and wiring instructions for successful hardware integration, showcasing text output on the display.
Hardware Preparation
- FireBeetle 2 ESP32-E (SKU: DFR0654) ×1
- Gravity: I2C OLED-128x64 Display(SKU: DFR0669)×1
- USB Data Cable ×1
Wiring Diagram

Other Preparation Work

This interface is a DFRbot dedicated GDI display interface for connecting a screen using a 18pin-FPC wire.
The pin list for using GDI camera interface is shown below:
| FPC PINS | Beetle ESP32 C3 Pins | Description |
|---|---|---|
| VCC | 3V3 | 3.3V |
| BLK (PWM dimming) | 10 | Backlight |
| GND | GND | GND |
| SCLK | 4/SCK | SPI clock |
| MOSI | 6/MOSI | Host output, slave input |
| MISO | 5/MISO | Host input, slave output |
| DC | 1 | Data/command |
| RES | 2 | Reset |
| CS | 7 | TFT Chip Select |
| SDCS | 0 | SD card chip select |
| FCS | NC | Font library |
| TCS | 3 | Touch |
| SCL | 22/SCL | I2C clock |
| SDA | 21/SDA | I2C data |
| INT | NC | INT |
| BUSY-TE | NC | Anti-tear pins |
| X1 | NC | custom pin 1 |
| X2 | NC | custom pin 2 |
When using FPC to connect the screen, please configure the corresponding pin numbers according to the GDL demo. Normally, only three pins need to be configured on different main controllers. The screen configuration is shown below:
/*ESP32 and ESP8266*/
#elif defined(ESP32) || defined(ESP8266)
#define TFT_DC D2
#define TFT_CS D6
#define TFT_RST D3
#define TFT_BL D13
Please refer to the GDL display screen wiki for specific usage instructions.
Sample Code:
Function program: Show "DFRobot" and "20220828" on the display.
#include "DFRobot_GDL.h"
#define TFT_DC D2
#define TFT_CS D6
#define TFT_RST D3
#define TFT_BL D13
DFRobot_ST7789_240x320_HW_SPI screen(/*dc=*/TFT_DC,/*cs=*/TFT_CS,/*rst=*/TFT_RST);
void setup() {
Serial.begin(115200); //Init
screen.begin();
screen.setTextSize(2); //Text size 4, range 1 to 4
screen.fillScreen(COLOR_RGB565_BLACK); //Screen background color
screen.setFont(&FreeMono12pt7b); // Font
screen.setCursor(/*x=*/10,/*y=*/120); // Starting point of the text
screen.setTextColor(COLOR_RGB565_LGRAY); //Text color
screen.print("DFRobot"); //Output text content
screen.setCursor(10,200);
screen.setTextColor(COLOR_RGB565_GREEN);
screen.setTextWrap(true);
screen.print("20220828");
}
void loop() {
}
Result
The display shows “DFRobot" and "20220828" when all ready.
Was this article helpful?
