Hi All,
I’m running into a weird glitch with the onboard memory of the Arduino and would like some help.
Problem: First image’s data is corrupted.
Project Goal: To display 3 images on an E-ink Display with a delay between them.
Analysis: When I upload and loop one image, the display works correctly. When I upload and loop two images, the display works correctly. But when I upload and loop three images the first image becomes corrupted. This issue occurs as I increase the number of images.
Since this failure only shows up when I have 3 or more images, I suspect the issue is because of how the Arduino stores data in the SRAM and how it’s being called. However, I’m not sure how to fix this problem.
Equipment: Arduino Mega 2560 R3 from Relegoo & WaveShare 7.5" E-ink display & E-paper Hat
**Hat:**https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT
**Image of a Working and Corrupted Display:**https://imgur.com/a/5C8qFaD
Primary Code:
#include <SPI.h>
#include <epd7in5.h>
#include "image1.h"
#include "image2.h"
#include "image3.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Epd epd;
if (epd.Init() != 0) {
Serial.print("e-Paper init failed");
return;
}
delay(50);
while(true)
{
epd.DisplayFrame(IMAGE1);
delay(20000);
epd.DisplayFrame(IMAGE2);
delay(20000);
epd.DisplayFrame(IMAGE3);
delay(20000);
}
}
Hex File for Image 1
extern const unsigned char IMAGE1[];
CPP File for Image 1: All other images follow this same pattern.
#include "image1.h"
#include <avr/pgmspace.h>
const unsigned char IMAGE1[] PROGMEM = {
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,...};
BookShelf.zip (718 KB)