Hi everyone.I want to interface 3x8x8 led matrix using 3 MAX72xx . I modified the library Led Control to work with x,y values and it works great. What i want to do is to get the characters from the font.h and copy the array of bytes in my array, and later to "print" this array. My copy function (void makeword) is not working so good...it is working perfectly for 1-5 characters.If i want to display 6 or more characters, my led display seems to be crazy .If i want to display an array prebiosly declared and manually loaded like temp2 everything works perfectly, nomatter the number of characters. If i want to display the generated array it works for only 5 characters; if i want 6 or more it works desastrous.I try to search a function like memcpy which have to add to the end of my generated array, but i didn't find...Any ideea ?
My code is this:
int k=0;
char text_afisare[] = "TESTTEST";
int nr_litere = strlen(text_afisare);
int nr_bytes = nr_litere*8;
byte temp[64];
byte temp2[328]={
B00000000,B11000000,B11000000,B11111111,B11111111,B11000000,B11000000,B00000000,B00000000,B11111111,B11111111,B11011011,B11011011,B11011011,B11000011,B00000000,B00000000,B01110010,B11111011,B11011011,B11011011,B11011111,B01001110,B00000000,B00000000,B11000000,B11000000,B11111111,B11111111,B11000000,B11000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B01111110,B11111111,B11000011,B11000011,B11111111,B01111110,B00000000,B00000000,B11111100,B11111110,B00000011,B00000011,B11111110,B11111100,B00000000,B00000000,B11111111,B11111111,B11011011,B11011011,B11011011,B11000011,B00000000,B00000000,B11111111,B11111111,B11001100,B11001100,B11111111,B01110111,B00000000,B00000000,B11111111,B11111111,B00111000,B00011100,B11111111,B11111111,B00000000,B00000000,B11111111,B11111111,B11011011,B11011011,B11011011,B11000011,B00000000,B00000000,B11000000,B11000000,B11111111,B11111111,B11000000,B11000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B11000000,B11000000,B11111111,B11111111,B11000000,B11000000,B00000000,B00000000,B11111111,B11111111,B11011011,B11011011,B11011011,B11000011,B00000000,B00000000,B01110010,B11111011,B11011011,B11011011,B11011111,B01001110,B00000000,B00000000,B11000000,B11000000,B11111111,B11111111,B11000000,B11000000,B00000000,
0x08, 0x04, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
0x10, 0x20, 0x40, 0x80, 0x80, 0x02, 0x02, 0x02,
0x99, 0x24, 0x42, 0x99, 0x99, 0x42, 0x24, 0x99,
0xFF, 0x81, 0xBD, 0xA5, 0xA5, 0xBD, 0x81, 0xFF,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC,
0x42, 0xC3, 0x24, 0x18, 0x18, 0x24, 0xC3, 0x42,
0xFD, 0x85, 0xB5, 0xA5, 0xA5, 0xBD, 0x81, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x7E, 0x7E, 0x7E, 0x7E, 0x42, 0x24, 0x18,
0x18, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x18,
0x78, 0x78, 0x18, 0xFF, 0xFF, 0x0C, 0x3C, 0x3C,
0xF2, 0x82, 0x12, 0x3A, 0x10, 0xC0, 0xC4, 0x0E,
0x7F, 0x84, 0xA7, 0x84, 0xA7, 0x84, 0x7F, 0x00,
0x3C, 0x42, 0x81, 0xA1, 0x89, 0x95, 0xA5, 0x42,
0x07, 0x2F, 0x1C, 0x3E, 0x3C, 0x30, 0x30, 0x30,
0x5A, 0x99, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18,
0x82, 0x41, 0x82, 0x41, 0x82, 0x41, 0x82, 0x41,
0x00, 0x01, 0x06, 0x7E, 0xDF, 0x7E, 0x06, 0x01,
0x04, 0x0F, 0x1F, 0x3C, 0x3C, 0x1F, 0x0F, 0x04,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x49, 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0x92,
0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49
};
void setup() {
lc.shutdown(0,false);
lc.shutdown(1,false);
lc.shutdown(2,false);
lc.setIntensity(0,15);
lc.setIntensity(1,15);
lc.setIntensity(2,15);
lc.clearDisplay(0);
lc.clearDisplay(1);
lc.clearDisplay(2);
makeword(text_afisare);
}
void initializare(){
lc.setIntensity(0,15);
lc.setIntensity(1,15);
lc.setIntensity(2,15);
lc.clearDisplay(0);
lc.clearDisplay(1);
lc.clearDisplay(2);
}
void matrice(unsigned long delaytime, byte character[]) {
lc.clearDisplay(0);
lc.clearDisplay(1);
lc.clearDisplay(2);
for(int i=23;i>=-nr_bytes;i--) {
for(int j=0;j<(24-i);j++) {
if(j < nr_bytes) {
scrie_coloana(i+j, character[j]);
} else {
scrie_coloana(i+j, false);
}
}
delay(delaytime);
}
}
void makeword(char text[])
{
for(int i=0;i<nr_litere;i++)
{
int val=0;
char ch=text[i];
if (ch < 32 || ch > 126){
ch = 32;
}
ch -= 32;
//for(int j=0;j<8;j++)
//{
temp[k]=font[ch][val];
temp[k+1]=font[ch][val+1];
temp[k+2]=font[ch][val+2];
temp[k+3]=font[ch][val+3];
temp[k+4]=font[ch][val+4];
temp[k+5]=font[ch][val+5];
temp[k+6]=font[ch][val+6];
temp[k+7]=font[ch][val+7];
k+=8;
//}
//memcpy(temp,font[ch],8);
//temp[k]=font[ch];
//k+=8;
}
}
void scrie_coloana(int coloana, byte informatie)
{
if(coloana<=7) lc.setRow(0,coloana,informatie);
if(coloana<=15) lc.setRow(1,coloana-8,informatie);
if(coloana<=23) lc.setRow(2,coloana-16,informatie);
}
void loop() {
delay(1000);
initializare();
matrice(100,temp);
}
PS : Sorry for my bad english