Hello,
I am trying to use Arduino Uno with 4.2 inch E paper to display. The connection is as follows
|e-Paper|Arduino UNO|
|Vcc|3.3V
|GND|GND|
|DIN|D11|
|CLK|D13|
|CS|D10|
|DC|D9|
|RST|D8|
|BUSY|D7|
I followed this link and tried to run the code of looping through integers to show real-time updating. This code was meant for 1.54 inch display, I changed the header file in my code for 4.2 inch display. I used library from waveshare.
The code I am using, is given below
/***************************************************************************
* Arduino e-Paper Text Display on Arduino
* -- looping through integers to show real-time updating
*
*
* by Josh Hrisko | Maker Portal LLC (c) 2021
*
*
***************************************************************************/
#include <SPI.h>
//#include "1_54in_epaper.h"
#include "epd4in2.h"
#include <stdlib.h>
#include "epdpaint.h"
#include "imagedata.h"
Epd epd; // initiate e-paper display [epd]
unsigned char image[1500]; // memory for display
Paint paint(image,400, 28); // setup for text display
#define COLORED 0 // background color handler (dark)
#define UNCOLORED 1 // background color handler (light)
int iter_val = 0; // storage variable for serial data
int initial_space = 10; // initial white/dark space at the top of the display
int row_line = 3; // counting rows to avoid overlap
int row_height = 24; // row height (based on text size)
void setup() {
Serial.begin(9600); // start serial handling for text input
epd.Init(); // initialize epaper
epd.ClearFrame(); // clear old text/imagery
//epd.DisplayPartBaseWhiteImage(); // lay a base white layer down first
}
void loop() {
String str_to_print = "Val: "; // string prepend
str_to_print+=String(iter_val); // add integer value
header_print(); // print header text
paint.Clear(UNCOLORED); // clear background
paint.DrawStringAt(0, 4, str_to_print.c_str(), &Font20, COLORED); // light background
epd.SetPartialWindow(paint.GetImage(), 0, initial_space+(3*row_height), paint.GetWidth(), paint.GetHeight());
//epd.DisplayPartFrame(); // display new text
epd.DisplayFrame(); // display new text
iter_val+=1; // increase integer value
}
void header_print(){
paint.SetWidth(200); // set display width
paint.SetHeight(24); // set initial vertical space
paint.Clear(COLORED); // darkr background
paint.DrawStringAt(0, 4, "1.54in e-Paper!", &Font20, UNCOLORED); // light text
epd.SetPartialWindow(paint.GetImage(), 0, initial_space+(0*row_height), paint.GetWidth(), paint.GetHeight());
paint.Clear(UNCOLORED); // light background
paint.DrawStringAt(0, 4, "Simple Demo", &Font20, COLORED); // dark text
epd.SetPartialWindow(paint.GetImage(), 0, initial_space+(1*row_height), paint.GetWidth(), paint.GetHeight());
paint.Clear(COLORED); // dark background
paint.DrawStringAt(0, 4, "Maker Portal", &Font20, UNCOLORED); // light text
epd.SetPartialWindow(paint.GetImage(), 0, initial_space+(2*row_height), paint.GetWidth(), paint.GetHeight());
}
But once I run the code , display does not show anything. There is no error message.
I do not understand the problem. Could anyone please help?