epaper-hello-world.ino

PaperDIY Assembly Kit · File : epaper-hello-world.ino · Language : C++ (Arduino) · Use case : Afficher un texte simple sur l'écran e-paper pour vérifier le fonctionnement de l'affichage.

Initializes the ED047TC1 e-paper display and prints a welcome message.

Uses the GxEPD2 library adapted for ESP32-S3. Verify specific GPIO pins for your PaperDIY kit revision. Compile with the ESP32 board manager. The display is static after refresh.

epaper-hello-world.ino

#include <Arduino.h>
#include <GxEPD2.h>
#include <GxEPD2_BW.h>
#include <GxEPD2_320.h>
#include <Fonts/FreeMonoBold9pt7b.h>

// Pin definitions for PaperDIY (ESP32-S3)
// Note: Check specific schematic for exact GPIOs if not using standard M5Stack library
// Assuming standard M5Stack PaperDIY pinout for GxEPD2
const int8_t EPD_BUSY = 40;
const int8_t EPD_DIO0 = 39;
const int8_t EPD_DIO1 = 38;
const int8_t EPD_DIO2 = 37;
const int8_t EPD_DIO3 = 36;
const int8_t EPD_DIO4 = 35;
const int8_t EPD_DIO5 = 34;
const int8_t EPD_DIO6 = 33;
const int8_t EPD_DIO7 = 32;
const int8_t EPD_CS = 21;
const int8_t EPD_DC = 20;
const int8_t EPD_RST = 22;
const int8_t EPD_PWR = 23;

class DisplayDriver : public GxEPD2_EPD {
public:
  DisplayDriver(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, 800, 600, 1) {}
  void init(uint32_t serial_diag_bitrate) override {
    GxEPD2_EPD::init(serial_diag_bitrate);
    // Specific init for ED047TC1 if needed, usually handled by GxEPD2_BW
  }
};

// Using a generic wrapper for simplicity in this example structure
// In real code, use the specific GxEPD2 display class for ED047TC1
GxEPD2_BW<GxEPD2_470_T75, GxEPD2_470_T75::HEIGHT> display(
  GxEPD2_470_T75(EPD_CS, EPD_DC, EPD_RST, EPD_BUSY)
);

void setup() {
  Serial.begin(115200);
  display.init(115200);
  display.setFont(&FreeMonoBold9pt7b);
  display.setTextColor(GxEPD_BLACK);
  display.fillScreen(GxEPD_WHITE);
  
  display.setCursor(10, 30);
  display.print("Hello PaperDIY!");
  display.display();
  delay(2000);
}

void loop() {
  // E-paper does not need continuous refresh
  delay(10000);
}

← Back to the board