2.13inch e-paper HAT not display

I’m trying to display the image in 2.13inch e-paper using Arduino UNO.
i downloaded the sample code from waveshare.It takes 440% Dynamic memory of Arduino UNO.

And i tried with this below code.It’s complied and uploaded successfully but not showing anything in E-paper.My code is :

#include <ePaper.h>
#include <SPI.h>
#include <SD.h>
#include “GT20L16_drive.h”

const int maxBarcodeSize = 10; // set the maximum barcode size to 10 digits
int barcode[maxBarcodeSize]; // initialise the barcode array to the maximum 10 digits
int barcodeText[maxBarcodeSize]; // initialise the barcodeText array to the maximum 10 digits
int barcodePos; // Used to identify each digit within the barcode
int barcodeLength; // Used to identify the actual length of the barcode

/* The following array holds the decimal code for each digit (0-9).
Each digit can be converted to binary and then drawn as a barcode.
0 1 2 3 4 5 6 7 8 9 */
int barcodeDecimal = {2669, 3371, 2859, 3477, 2667, 3381, 2869, 2651, 3373, 2861};

int astrix = 2413; // “*” character decimal code used at beginning and end of barcode sequence

/* When drawBarcode = “no”, the program will not draw the barcode on the e-paper panel
When drawBarcode = “yes”, the command to draw the barcode on the e-paper panel will be triggered. */
String drawBarcode = “no”;

/* This variable is the x Position on the e-Paper panel screen */
int xPosition;

void setup(){
Serial.begin(9600); // Initialise Serial communication
EPAPER.begin(EPD_2_0); // Set the e-Paper panel size to 2 inches
EPAPER.setDirection(DIRNORMAL); // Set the e-Paper panel display direction (to Normal)
eSD.begin(EPD_2_0); // Prepares the SD card
GT20L16.begin(); // Initialise the GT20L16 font chip on the e-Paper panel
barcodePos = 0; // Set the barcode digit to the first digit in the barcode
EPAPER.clear_sd(); // Clear the screen when starting sketch
Serial.println(“Enter barcode”);
EPAPER.drawString("Milo Nuggets $2.50 ", 10, 20); //splash screen text

EPAPER.display(); // Display the splash screen
}

void loop(){

// The Arduino will wait until it receives data from the Serial COM port

while (Serial.available()>0){
// barcodeText[barcodePos] = Serial.read();
barcodeText[barcodePos] = Serial.read();

if(barcodeText[barcodePos]>47 && barcodeText[barcodePos]<58){ // A number was sent
barcode[barcodePos] = barcodeText[barcodePos]-48; // Convert the decimal value from the serial monitor to a Number
}

if(barcodeText[barcodePos]==46){ // If a “.” is detected, then barcode is complete
barcodeLength = barcodePos; // Set the length of the barcode (used later)
drawBarcode = “yes”; // We can now draw the barcode

}

if(barcodePos>(maxBarcodeSize-1)){ // Check if maximum barcode length has been reached
barcodeLength = barcodePos; // Set the length of the barcode (used later)
drawBarcode = “yes”; // We can now draw the barcode
}

barcodePos++; // Move to the next barcode digit
}

if(drawBarcode == “yes”){ // Only draw the barcode when drawBarcode = “yes”

EPAPER.clear_sd(); // Clear the e-Paper panel in preparation for barcode
xPosition = 15; // Set the initial white-space on the left
drawBCode(astrix, ’ '); // Each barcode starts with an invisible *

for(int digit=0; digit<barcodeLength; digit++){ // Start drawing the barcode numbers
drawBCode(barcodeDecimal[barcode[digit]], barcodeText[digit]); // Call the drawBCode method (see below)
}

drawBCode(astrix, ’ '); // Each barcode ends with an invisible *
EPAPER.display(); // Show the barcode image and text

drawBarcode = “no”; // Stop it from drawing again until next barcode sequence sent
barcodePos=0; // Re-initialise the position back to first digit (in preparation for the next barcode)
}
}

//The drawBCode method is the key method for drawing the barcode on the e-paper panel
void drawBCode(int bCode, char bCodeText){
xPosition++; // There is a white space between each digit
for (int barPos = 11; barPos > -1; barPos–){ // Cycle through the binary code for each digit. Each digit is made up of 11 bars
xPosition++; // Advance the xPosition to draw the next bar (white or black)
if(bitRead(bCode, barPos)==1){ // If the binary digit at this position is a 1, then draw a black line
EPAPER.drawVerticalLine(xPosition, 10, 60); // This draws the individual Bar (black - only)
} // If the binary digit is a 0, then it is left blank (or white).
}
EPAPER.drawChar(bCodeText, xPosition-9, 75); // Draw the human readable (text) portion of the barcode
}

Can anybody help me resolve this issue…Thanks in Advance

First, please edit your message and place CODE tags around your code, to make it easier to read. You can also help by typing CTRL T in the Arduino IDE to make it even more easier… :slight_smile:

Apart from that, I really don’t understand your code and your question.

The image you post is a copy of an example file from the EPD libraries of Bodmer and it is very different from the code you post, which doesn’t use these libraries.

What is this library you use? Where does it come from?

#include <ePaper.h>

You use an instanciation called EPAPER everywhere in your code, but it’s never defined:
EPAPER.begin(EPD_2_0);That line tells about a 2 inches display but you mention a 2.13"…?

The rest of the code may be ok, you just have to select the proper library (I’d suggest this one) and declare and connect the display correctly

#include <epd2in13.h>
Epd EPAPER;

The memory problem with the example code of Bodmer comes from the image it displays: look at the size of the image file !

can anybody suggest why this happening ?

Have you tried drawing something simpler, like just a square box? Get the basics working before you try the complex stuff.