I have a Waveshare 2.66" E-paper display. I have set it up according to Waveshare's guide using Waveshare's library, found here.
I'm trying to display three words, each on their own line. The first word should appear, then the second, then the third, with the previous words remaining visible. Instead, I see the previous word disappears when I display the new word. I understand this display supports partial updates.
I ran the library demo code and experimented to better understand it. My code is below. I've commented it with my understanding of what each line is doing. I'd be grateful to learn where I'm going wrong.
#include <SPI.h>
#include "epd2in66.h"
#include "imagedata.h"
#include "epdpaint.h"
#define COLORED 0
#define UNCOLORED 1
UBYTE image[600]; // create a 1D array
Paint paint(image, 56, 20); // make array 2D with defined width and height, this is the image buffer, width should be the multiple of 8
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // initialize serial
Epd epd; // initialize display
if (epd.Init() != 0) { // if display initialize hasn't worked...
Serial.print("e-Paper init failed..."); // ...tell the user
return;
}
paint.SetRotate(ROTATE_0); // use default screen orientation
epd.Clear(); // clear physical display
epd.Init_Partial(); // enable partial update functionality
paint.Clear(COLORED); // set all image buffer pixels to black
paint.DrawStringAt(0, 0, "HELLO", &Font16, UNCOLORED); // write text to image buffer, coordinates define where to start writing in the buffer
epd.DisplayFrame_part(paint.GetImage(),0,0,56,20); // at defined location and area, update this part of the screen with the image buffer
delay(1000);
paint.Clear(COLORED);
paint.DrawStringAt(0, 0, "HEY", &Font16, UNCOLORED);
epd.DisplayFrame_part(paint.GetImage(),0,30,56,20);
delay(1000);
paint.Clear(COLORED);
paint.DrawStringAt(0, 0, "HI", &Font16, UNCOLORED);
epd.DisplayFrame_part(paint.GetImage(),0,60,56,20);
}
void loop() {
// put your main code here, to run repeatedly:
}