#include <SPI.h>
#include <GxEPD2_BW.h>
#include <Adafruit_GFX.h> // Core graphics library
#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));
const char HelloWorld[] = "Hello World!";
int buttonState;
int buttonPress;
void setup()
{
SPI.begin(EPD_SCLK, EPD_MISO, EPD_MOSI);
display.init();
Serial.begin(115200);
pinMode(buttonPin, INPUT_PULLUP);
}
void helloWorld()
{
Serial.println(("Begin loop"));
display.setRotation(1);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby; uint16_t 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();
};
Loading
epaper-2in9
epaper-2in9