// GxEPD2_HelloWorld.ino by Jean-Marc Zingg
// see GxEPD2_wiring_examples.h for wiring suggestions and examples
// if you use a different wiring, you need to adapt the constructor parameters!
// uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX
//#include <GFX.h>
#include <SPI.h>
#include <GxEPD2_BW.h>
// #include <GxEPD2_3C.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Fonts/FreeMonoBold9pt7b.h>
#define EPD_CS 15
#define EPD_DC 21
#define EPD_RST 22
#define EPD_BUSY 23
#define EPD_SCLK 4
#define EPD_MISO -1
#define EPD_MOSI 5
const int buttonPin = 26;
GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=*/ EPD_CS, /*DC=*/ EPD_DC, /*RST=*/ EPD_RST, /*BUSY=*/ EPD_BUSY));
// GxEPD2_BW<GxEPD2_290_T5D, GxEPD2_290_T5D::HEIGHT> display(GxEPD2_290_T5D(/*CS=12*/ SS, /*DC=*/ 27, /*RST=*/ 15, /*BUSY=*/ 32)); // GDEW029T5D 128x296, UC8151D
// GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=*/ 12, /*DC=*/ 27, /*RST=*/ 15, /*BUSY=*/ 32)); // GDEW029Z10 128x296, UC8151 (IL0373)
// GxEPD2_BW<GxEPD2_290_GDEY029T94, GxEPD2_290_GDEY029T94::HEIGHT> display(GxEPD2_290_GDEY029T94(/*CS=D8*/ EPD_CS, /*DC=D3*/ EPD_DC, /*RST=D4*/ EPD_RST, /*BUSY=D2*/ EPD_BUSY)); // GDEY029T94 128x296, SSD1680, (FPC-A005 20.06.15)
const char HelloWorld[] = "Hello World!";
int buttonState;
int buttonPress;
void setup()
{
SPI.begin(EPD_SCLK, EPD_MISO, EPD_MOSI);
//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
display.init();
Serial.begin(115200);
pinMode(buttonPin, INPUT_PULLUP);
}
void helloWorld()
{
Serial.println(("Begin loop"));
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());
Serial.println("End loop");
delay(10000);
}
void buttonListener() {
buttonPress = 1;
buttonPress--;
}
void loop() {
Serial.begin(115200);
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
Serial.println(("button"));
}
helloWorld();
};