So im programming a Rainbowduino with an RGB LED matrix on it, and i wrote a program that scrolls a char array accross. Like a any generic LED board does. all the variable letters look kinda like
char* a[8]={
"00111100",
"01111110",
"01100110",
"01100110",
"01111110",
"01111110",
"01100110",
"01100110"};
And add(char* in[8]) just keeps adding on the lines to 8 strings I have set up(one for each line, named line0,line1...).
Here is the important stuff:
char output[]="abcdefghijklmnop";
//in setup, adds each letter to the end of each line
for(count=0;count<sizeof(output)-1;count++){
switch(output[count]){
case 'a':add(a);break;
case 'b':add(b);break;
case 'c':add(c);break;
case 'd':add(d);break;
case 'e':add(e);break;
case 'f':add(f);break;
case 'g':add(g);break;
case 'h':add(h);break;
case 'i':add(i);break;
case 'j':add(j);break;
case 'k':add(k);break;
case 'l':add(l);break;
case 'm':add(m);break;
case 'n':add(n);break;
case 'o':add(o);break;
case 'p':add(p);break;
case 'q':add(q);break;
case 'r':add(r);break;
case 's':add(s);break;
case 't':add(t);break;
case 'u':add(u);break;
case 'v':add(v);break;
case 'w':add(w);break;
case 'x':add(x);break;
case 'y':add(y);break;
case 'z':add(z);break;
case ' ':add(space);break;
case '!':add(excl);break;
case '\'':add(apos);break;
case '?':add(quest);break;
}
}
//in loop
for(int row=0;row<line2.length();row++){
for(int xx=0;xx<8;xx++){
char zero=line0[xx+row];
char one=line1[xx+row];
char two=line2[xx+row];
char three=line3[xx+row];
char four=line4[xx+row];
char five=line5[xx+row];
char six=line6[xx+row];
char seven=line7[xx+row];
if(zero=='1')
Rb.setPixelXY(0,xx,0,0,255);
if(one=='1')
Rb.setPixelXY(1,xx,0,0,255);
if(two=='1')
Rb.setPixelXY(2,xx,0,0,255);
if(three=='1')
Rb.setPixelXY(3,xx,0,0,255);
if(four=='1')
Rb.setPixelXY(4,xx,0,0,255);
if(five=='1')
Rb.setPixelXY(5,xx,0,0,255);
if(six=='1')
Rb.setPixelXY(6,xx,0,0,255);
if(seven=='1')
Rb.setPixelXY(7,xx,0,0,255);
}
delay(100);
Rb.blankDisplay();
}
Except weird things happen when I change output, if output's length is 8 or less, it works fine. If the length is greater than 8, the first 7 come out fine, then random lines will stop lighting up until it reaches the 18th letter, which will never light up. If the length is 21 or greater, the entire display will do nothing.
A text file with the full code is provided. Thanks to any and all who try to help!
code.txt (5.89 KB)