epaper-grayscale-test.ino

M5Stack PaperDIY Assembly Kit (ESP32-S3) · File : epaper-grayscale-test.ino · Language : C++ (Arduino) · Use case : Afficher un dégradé de 16 niveaux de gris sur l'écran e-paper ED047TC1.

Demonstrates e-paper screen control to display a full grayscale palette.

The ED047TC1 screen uses an 8-bit parallel interface managed by M5Unified. Screen updates are slow (several seconds) to prevent ghosting. Do not refresh the screen in a fast loop.

epaper-grayscale-test.ino

#include <M5Unified.h>

void setup() {
  M5.begin();
  M5.Display.setBrightness(255);
  M5.Display.fillScreen(GRAY_BLACK);
  M5.Display.setCursor(0, 0);
  M5.Display.setTextColor(GRAY_WHITE, GRAY_BLACK);
  M5.Display.setTextSize(2);
  M5.Display.println("16-Grayscale Test");
  
  int w = M5.Display.width();
  int h = M5.Display.height();
  int barHeight = h / 16;
  
  for (int i = 0; i < 16; i++) {
    uint8_t gray = (uint8_t)(255 - (i * 16)); // Approximate mapping
    M5.Display.fillRect(0, i * barHeight, w, barHeight, gray);
  }
  M5.Display.display();
}

void loop() {
  // E-paper ne nécessite pas de rafraîchissement continu
  delay(10000);
}

← Back to the board