Hello,
I have an e-ink display with an ESP32 board. I am trying to display some text on my screen, but I can't find a library that works consistently.
I have tried using GxEPD and GxEPD2, but they only work when I use #include <GxGDEW075Z09/GxGDEW075Z09.h> // 7.5" b/w/r, and then #include <GxGDEW075Z08/GxGDEW075Z08.h> // 7.5" b/w/r 800x480.
However, if I try using just the first one, it displays random things, and if I try using only the second one, it works the first time but doesn't work again after that.
I can't find any other good libraries or info for my display.
This is my hardware:
| Utility | Reference | Characteristic | Link |
|---|---|---|---|
| e-Ink | Ink Cubic MF-17502-M009F | 7.5 inch tri-color 800x480 | Product Page |
| ESP32 | FireBeetle 2 ESP32-C6 | Wiki | |
| Connector | GooDisplay DESPI-C02 | Product Page |
My Connection:
| Display | GPIO |
|---|---|
| 3v3 | 14 |
| GND | GND |
| SDI | 22 |
| SCK | 23 |
| CS | 18 |
| DC | 20 |
| RES | 19 |
| BUSY | 1 |
My code:
#include <GxEPD.h>
// First Run:
// #include <GxGDEW075Z09/GxGDEW075Z09.h> // 7.5" b/w/r
// Second run:
#include <GxGDEW075Z08/GxGDEW075Z08.h> // 7.5" b/w/r 800x480
#include GxEPD_BitmapExamples
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
GxIO_Class io(SPI, /*CS=5*/ 18, /*DC=*/20, /*RST=*/19);
GxEPD_Class display(io, /*RST=*/19, /*BUSY=*/1);
void setup() {
// Dosn't change anything:
// SPI.end();
// SPI.begin(23, 21, 22, 18);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
Serial.begin(115200);
Serial.println("------------");
Serial.println("setup");
display.init(115200); // enable diagnostic output on Serial
Serial.println("3");
display.drawPaged(drawHelloWorld);
display.powerDown();
digitalWrite(LED_BUILTIN, LOW);
Serial.println("setup done");
}
void loop(){};
const char HelloWorld[] = "test";
void drawHelloWorld() {
Serial.println("drawHelloWorld");
display.eraseDisplay();
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby;
uint16_t tbw, tbh;
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
// center bounding box by transposition of origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby;
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(HelloWorld);
Serial.println("drawHelloWorld done");
}