Untitled
Anonymous
plain_text
02/25/2024 5:24 PM
1.9 KB
37
Indexable
// GxEPD2_HelloWorld.ino by Jean-Marc Zingg
const int MosfetEP = 16;
#include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include "GxEPD2_display_selection_added.h"
GxEPD2_BW<GxEPD2_290_GDEY029T94, GxEPD2_290_GDEY029T94::HEIGHT> display(GxEPD2_290_GDEY029T94(/*CS=5*/ 10, /*DC=*/ 40, /*RST=*/ 41, /*BUSY=*/ 42)); // GDEY029T94 128x296, SSD1680, (FPC-A005 20.06.15)
void setup()
{
pinMode(MosfetEP, OUTPUT);
digitalWrite(MosfetEP, HIGH); // turn the power Regilation on for the ePaper Display
delay (1000);
//display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
helloWorld();
display.hibernate();
}
const char HelloWorld[] = "Hello World!";
void helloWorld()
{
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 the bounding box by transposition of the origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby;
display.setFullWindow();
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(HelloWorld);
}
while (display.nextPage());
}
void loop() {};Editor is loading...
Leave a Comment