Hello,
at the moment i am building an advent calendar with an Arduino Mega. This is my first Arduino project and first time with C(++) (just Java /Python before). In the middle is a 12x12 RGB LED matrix. I want to display each day a different picture (frame) with the LEDs. For this i added a clock module, so i can get always the current day.
Each image i store in a 3D byte vector, one for each day: 1 dimension is the frame (some days have multiple frames for animation, 2. one is the channel (red, green, blue) and 3rd dimension is the Byte itself. Each bit represents one LED. here is an example:
//Note
std::vector<std::vector<std::vector<byte>>> getDec03() {
return {
{
{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}, //R
{B00000000,B00000000,B00000000,B00000001,B11000011,B10011100,B00111001,B11000000,B10011100,B00100001,B00000000,B10000100,B00100001,B00000000,B11111100,B00000000,B00000000,B00000000}, //G
{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000} //B
},
{
{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}, //R
{B00000000,B00000000,B00000000,B00000000,B00000011,B10000000,B00111001,B11000011,B10011100,B00111001,B00000000,B10000100,B00100001,B00000000,B10000100,B00111111,B00000000,B00000000}, //G
{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000} //B
}
};
}
There is a helper method to return the vectors:
std::vector<std::vector<std::vector<byte>>> getFrames(uint8_t day) {
switch (day) {
case 1:
return getDec01();
case 2:
return getDec02();
case 3:
return getDec03();
...
which is called to get the frame(s) of the current day:
std::vector<std::vector<std::vector<byte>>> frames;
...
frames = getFrames(getCurrentDay());
My problem is, that when i want to compile my program with all iamges i get the following message:
Der Sketch verwendet 51292 Bytes (20%) des Programmspeicherplatzes. Das Maximum sind 253952 Bytes.
Globale Variablen verwenden 6556 Bytes (80%) des dynamischen Speichers, 1636 Bytes für lokale Variablen verbleiben. Das Maximum sind 8192 Bytes.
Wenig Arbeitsspeicher verfügbar, es können Stabilitätsprobleme auftreten.
The program won't do anything on the Arduino with this warning, it seems to crash soon after the start. The amount of Bytes in all the vectors is around 3672. I attached for some other parts an SD shield to the Arduino. My idea was to store all vectors on the SD card, maybe one file for each day. But i have no idea how to write and read the data. All examples i could find handle a lot more easier data and with my own ideas i came after over a week to end now.
Can you help me how to solve my problem? I am open to other solutions like eeprom (which i tried too, but no success). I would be happy if i could keep my frame data layout even if my be not the nicest, but it wa sa lot of work ![]()
Thank you.