Weird things happening with LED matrix

Can't find a proper forum to drop the topic, drop here.

Moderators: lily.li, violet

Post Reply
Joshie196
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Fri Jun 15, 2012 2:44 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: Rainbowduino

Weird things happening with LED matrix

Post by Joshie196 » Sun Jun 17, 2012 6:15 am

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:

Code: Select all

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.
Thanks to any and all who help!

Tobe
Pre-kindergarten
Pre-kindergarten
Posts: 34
Joined: Tue Jan 17, 2012 11:04 am
Are you a staff member of seeedstudio?: yes
Which products/projects are your favorite?: Seeeduino

Re: Weird things happening with LED matrix

Post by Tobe » Wed Jun 20, 2012 4:37 pm

Hi Joshie,
What I think is your array of the "abcd...." is code is use char,it is use the ram,so it is waste the ram,
so what i suggest is change this

Code: Select all

char* a[8]={
"00111100",
"01111110",
"01100110",
"01100110",
"01111110",
"01111110",
"01100110",
"01100110"};

into to this:

Code: Select all

const char* a[8]={
"00111100",
"01111110",
"01100110",
"01100110",
"01111110",
"01111110",
"01100110",
"01100110"};
all the array of the letter should be change like this,
then try you code again,it would be fine.

Post Reply