Hello,
I have the Rainbowduino V1.2 + LED Matrix connected with an FTDI 5V Breakout to program the Rainbowduino. The connection is no problem and with the Arduino-Suite I can flash the Rainbowduino.
My goal: I want to flash several "frames" with 4096 colors (16^3) onto the Rainbowduino which should be repeated in a loop. With other words: a slide show with several "pictures"
Now my problem is:
My base for the development is the default program "rainbow_plasma". In effect I just use the function "SetPixel(x,y,Green,Red,Blue)". In the File I made an Array with size [3][8][8] to store one picture. With one picture (frame) I have no problems and it works very well. But if I try it with two or more frames only some LEDs sporadic are shining or all is dark. I think that I have a RAM overflow when I use 2 or more Arrays with size [3][8][8].
But how could I save my Arrays into the EEPROM? and how could I read it out of the EEPROM?
Here my Arrays (in data.c)
unsigned char frame_0[3][8][8] =
{
{//red
{0,240,240,240,240,240,240,0},
{0,0,0,0,0,0,0,0},
{0,240,240,0,0,240,240,0},
{0,240,240,0,0,240,240,0},
{0,240,240,0,0,240,240,0},
{0,240,240,240,240,240,240,0},
{0,0,0,0,0,0,0,0},
{0,240,240,0,0,240,240,0}
}, {//green
{255,240,240,240,240,240,240,255},
{255,255,255,255,255,255,255,255},
{255,240,240,255,255,240,240,255},
{255,240,240,255,255,240,240,255},
{255,240,240,255,255,240,240,255},
{255,240,240,240,240,240,240,255},
{255,255,255,255,255,255,255,255},
{255,240,240,255,255,240,240,255}
}, {//blue
{0,240,240,240,240,240,240,0},
{0,0,0,0,0,0,0,0},
{0,240,240,0,0,240,240,0},
{0,240,240,0,0,240,240,0},
{0,240,240,0,0,240,240,0},
{0,240,240,240,240,240,240,0},
{0,0,0,0,0,0,0,0},
{0,240,240,0,0,240,240,0}
}
};
unsigned char frame_1[3][8][8] =
{
{//red
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0}
}, {//green
{255,0,0,0,0,0,0,255},
{255,255,255,255,255,255,255,255},
{255,0,0,255,255,0,0,255},
{255,0,0,255,255,0,0,255},
{255,0,0,255,255,0,0,255},
{255,0,0,0,0,0,0,255},
{255,255,255,255,255,255,255,255},
{255,0,0,255,255,0,0,255}
}, {//blue
{0,255,255,255,255,255,255,0},
{0,0,0,0,0,0,0,0},
{0,255,255,0,0,255,255,0},
{0,255,255,0,0,255,255,0},
{0,255,255,0,0,255,255,0},
{0,255,255,255,255,255,255,0},
{0,0,0,0,0,0,0,0},
{0,255,255,0,0,255,255,0}
}
};
Here the code how the diffrent frames should be "loaded"
//load frames from data.c
extern unsigned char frame_0[3][8][8];
extern unsigned char frame_1[3][8][8];
void
plasma_morph(int frameNumber)
{
int x,y;
if (frameNumber==0)
{
for(x = 0; x < screenWidth; x++)
for(y = 0; y < screenHeight; y++)
SetPixel(x,y,frame_1[1][x][y],frame_1[0][x][y],frame_1[2][x][y]);
}
if (frameNumber==1)
{
for(x = 0; x < screenWidth; x++)
for(y = 0; y < screenHeight; y++)
SetPixel(x,y,frame_0[1][x][y],frame_0[0][x][y],frame_0[2][x][y]);
}
}
And finally the loop
unsigned int sumFrames=2;
unsigned int aktFrame=0; //actual frame
void loop() // run over and over again
{
//Schleife welche die Verschiedenen Frames abspielt
if (count > 1000)
{
if (aktFrame == sumFrames-1)
{
aktFrame=0;
}
else
{
aktFrame++;
}
plasma_morph(aktFrame);
count = 0;
}
Thank you for your help,
and sorry for my bad english
christoph820