I am using an Adafruit 64x32 RGB LED panel with my Arduino Mega 2560. I tried to find/construct working examples of a 32x32 or wider scrolling text/bitmap but have failed.
The smaller version is working and is calling two functions for it to implement:
loadSprite(IMAGES2,60);
bildmittig_sprite(data,dpink,300);
IMAGES2
is of typeconst PROGMEM byte IMAGES2[][8]
and is an array of several 8x8 bitmapsdata
is a buffer data array element, containing the dynamic movement of bitmaps, called in thevoid loop()
For the whole code here. For the video clip smaller scroller here.
For the video clip to what I would like to extend to:
Russian Letters: http://dropbox.com/s/n2ilxqgubn83ii9/MOV_0056.mp4?dl=0
Or Chinese Letters: http://dropbox.com/s/9rad116adc575u1/MOV_0057.mp4?dl=0
loadSprite()
looks like this:
void loadSprite(const PROGMEM byte bild[][8],int anzahl) {
for(int row=0; row < 8; row++) {
//iterate through each row
data[row] = 0;
//reset the row we're working on
for(int column=0; column < 8; column++) {
//iterate through each column
data[row] = data[row] + ((powers[column] & (pgm_read_byte(&(bild[index][row])) << offset)));
//loads the current charachter offset by offset pixels
data[row] = data[row] + (powers[column] & (pgm_read_byte(&(bild[index+1][row])) >> (8-offset)));
//loads the next charachter offset by offset pixels
}
}
offset++;
//increment the offset by one row
if(offset==8){offset = 0; index++; if(index==anzahl){index=0;}}
//if offset is 8 load the next character pair for the next time through
}
The displaying function (places it i the middle of 32x32 panel) like this:
void bildmittig_sprite (byte bild[8],word cchsv, int duration) {
for(int i = 0; i <8; i++) {
for(int ii = 0; ii<8; ii++) {
int bit = (bild[i] >> ii) & 1;
if(bit == 0) {
matrix.drawPixel(7-ii+12, 12+i, black);
} else {
matrix.drawPixel(7-ii+12, 12+i, cchsv);
}
}
}
delay(duration);
}
Working for 8x8 bitmaps, It eludes me how I could possible extend the coding (scrolling) for bitmaps like this:
const PROGMEM unsigned char rus5[] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0x03,
0x00, 0x00, 0x78, 0x00,
0x00, 0x00, 0x38, 0x00,
0x00, 0x00, 0x3c, 0x00,
0x00, 0x00, 0x1c, 0x00,
0x00, 0x00, 0x1c, 0x00,
0x00, 0x00, 0x1e, 0x00,
0x00, 0xfc, 0xde, 0x0f,
0x00, 0x8f, 0xef, 0x1f,
0x80, 0x07, 0x3f, 0x3c,
0xc0, 0x03, 0x0f, 0x3c,
0xe0, 0x01, 0x0f, 0x3c,
0xe0, 0x01, 0x07, 0x3c,
0xf0, 0x80, 0x07, 0x3c,
0xf0, 0x80, 0x03, 0x3c,
0x70, 0x80, 0x03, 0x1e,
0x78, 0xc0, 0x03, 0x1e,
0x78, 0xc0, 0x03, 0x0f,
0x78, 0xe0, 0x01, 0x0f,
0x78, 0xf0, 0x81, 0x07,
0xf0, 0xf8, 0xc3, 0x03,
0xf0, 0xef, 0xf6, 0x01,
0xe0, 0xf7, 0x7c, 0x00,
0x00, 0xf0, 0x00, 0x00,
0x00, 0x70, 0x00, 0x00,
0x00, 0x70, 0x00, 0x00,
0x00, 0x78, 0x00, 0x00,
0x00, 0x78, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x00,
0x80, 0xff, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00
};
I tried variants of concatenation, like:
- 4 bytes as a row, stitching together several with beforehand created
data
(data1
...
data4
) elements (also adjust coherence for vertical elements). - And then have them displayed at the correct place to be able to use the existing code but so far only vertical concatenation seemed to work briefly.
I am at the end of my wits for this project, but maybe somebody else sees a better way.