Example Code for Arduino-Graphic Display

Last revision 2025/12/27

This article guides users on setting up Arduino for graphic displays using FireBeetle ESP32 and ePaper modules, including detailed operation steps and sample code.

Hardware Preparation

Software Preparation

Operation Description

Operation Step Detailed Description
1. Select Pins Select D3 (Ink Screen CS) and D6 (Font Library CS)
2. Module Connection Plug the module into the ESP32 or ESP8266 development board

Sample Code

Initialize IL3895 e-paper screen, display string and draw various black shapes.

#include "Arduino.h"
#include "DFRobot_IL3895_SPI.h"

DFRobot_IL3895_SPI epaper;

#define EPAPER_CS  D3
#define Font_CS  D6
#define EPAPER_DC  D8
#define EPAPER_BUSY     D7

void setup(void)
{
    Serial.begin(115200);
    epaper.begin(EPAPER_CS, Font_CS, EPAPER_DC, EPAPER_BUSY); //Select the corresponding pins
    epaper.fillScreen(WHITE);//Clear the screen and display white
    epaper.flush(FULL);  //Refresh screen display
    /*Displays a string, black font*/
    epaper.disString(0,0,1,"SPI",BLACK);
    epaper.flush(PART);

    /*Let me draw a red dot*/
    for(uint8_t x=12,y=12; y<110; y+=3)
    {
        epaper.drawPixel(x,y,BLACK);
    }
    epaper.flush(PART);

    /*Draw two lines*/
    epaper.drawLine(24,12, 36,110,BLACK);
    epaper.drawLine(36,12, 24,110,BLACK);
    epaper.flush(PART);

    /*Draw a red rectangle*/
    epaper.drawRect(48,12, 40,98,BLACK);
    epaper.flush(PART);

    /*Fill a rectangle with black*/
    epaper.fillRect(55,19, 26,84,BLACK);
    epaper.flush(PART);

    /*Draw a hollow circle*/
    epaper.drawCircle(122,37, 25,BLACK);
    epaper.flush(PART);

    /*Draw a solid circle*/
    epaper.fillCircle(122,37, 18,BLACK);
    epaper.flush(PART);

    /*Draw a rounded rectangle*/
    epaper.drawRoundRect(97,67, 50,43, 10,BLACK);
    epaper.flush(PART);

    /*Fill in a rounded rectangle*/
    epaper.fillRoundRect(102,72, 40,33, 8,BLACK);
    epaper.flush(PART);

    /*Draw a triangle*/
    epaper.drawTriangle(180,12, 155,110, 205,110,BLACK);
    epaper.flush(PART);

    /*Fill in a triangle*/
    epaper.fillTriangle(180,23, 162,105, 198,105,BLACK);
    epaper.flush(PART);

    /*Prompt characters*/
    epaper.disString(215,12, 2,"pic",BLACK);
    epaper.disString(215,78, 2,"shape",BLACK);
    epaper.flush(PART);
}

void loop(void)
{
    delay(8000);
}

Result

The display includes drawing points, drawing lines, drawing rectangular boxes,drawing filled rectangles, drawing circles, drawing filled circles, drawing rounded rectangles, drawing filled rounded rectangles, and displaying characters (including letters and Chinese characters).

DFR0511_Display graphics

Was this article helpful?

TOP