Example 1: Hello World!
In this first section we show you how to initialize the ePaper display and write “Hello World!” on the screen. It is the shortest possible demo, you will see it’s really simple!
Demo
Sketch
Now let’s have a look at the code: The first lines in the setup section are required to define the SPI settings needed to communicate with the display IC. Before you can talk to your display, the function begin()
needs to be called once in the setup()
loop. This initialises your ePaper screen and resets it to a solid white background. To write text, the function print()
or println()
can be used. Call update()
to actually trigger an update. This refresh the screen with the content of the previously filled image buffer. The running demo should look like the video in the section above.
#include "Adafruit_GFX.h"
#include "PL_microEPD.h"
#define EPD_RST A0
#define EPD_BUSY A1
#define EPD_CS A2
PL_microEPD display(EPD_CS, EPD_RST, EPD_BUSY);
void setup() {
SPI.begin(); // SPI-Bus initialisation
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV4);
display.begin(); // Paperino ePaper initialisation and refresh screen
display.println("Hello World!");// Write message into memory buffer
display.update(); // Trigger a full image update
}
void loop() {
}
Are you interested in printing more complicated things on the screen? Then let’s proceed with the following GFX example, which shows you how to draw text in different sizes and how to draw graphic elements like lines, circles & rectangles.