# Led Matrix message scroller

My basic "end-result" is that I can give my program a string, and my 8 by 8 LED matrix would output it until I change the string.

I already have the code to display a sprite from bytes (similar to the one in the bitmath tutorial), and I also have code to read an array of bytes and scroll them (for example the array shown would scroll "HELLO"

``````B11111110,
B00010000,
B00010000,
B00010000,
B11111110,
B00000000,
B11111110,
B10010010,
B10010010,
B10010010,
B10010010,
B00000000,
B11111110,
B10000000,
B10000000,
B10000000,
B00000000,
B11111110,
B10000000,
B10000000,
B10000000,
B00000000,
B01111100,
B10000010,
B10000010,
B10000010,
B01111100,
B00000000
``````

My problem is that I have absolutely no idea how to convert the string into an array of this form, and http://dotmatrixdesign.tumblr.com/ gave me the idea to make a char library but I didn't get very far.

Any help would be appreciated, even if it means my current pieces of code are wasted.

You're trying to do something like this right? - http://www.vimeo.com/2807276

well, yes and no…I’m not using any ICs between the LEDs and the Arduino.

Let me just post up most of my code. I am very sorry if it is too obfuscated…It’s one of my bad habits to shorten code…

``````byte bitData[]={
//insert data here in the format shown in the previous post
};
int numframes=(sizeof(bitData)/sizeof(byte));
byte sprite[8];

const int pinArr[2][8]={{14,4,5,11,7,12,16,17},{6,3,8,2,13,9,15,10}};
#define col 0
#define row 1
#define colon (col?HIGH:LOW)
#define rowon (row?HIGH:LOW)
#define colof rowon
#define rowof colon
#define ondelayms 50
#define framestay 20
void setup(){DDRD|=B11111100;DDRB=DDRC=B111111;for(byte i=0;i<8;i++){digitalWrite(pinArr[col][i],colof);digitalWrite(pinArr[row][i],rowof);}}

void loop()
{
for(int frame=0;frame<numframes;frame++)
{
for(byte i=0;i<8;i++){sprite[i]=bitData[frame+i-(((frame+i)<numframes)?0:numframes)];}
dispSprite(sprite);
}
}

void dispSprite(byte *frame)
{
for(byte st=0;st<framestay;st++)
{
for(byte i=0;i<8;i++)
{
byte data=frame[i];digitalWrite(pinArr[row][i],rowon);
for(byte j=0;j<8;j++){digitalWrite(pinArr[col][j],(data&(1<<j))?colon:colof);delayMicroseconds(ondelayms);digitalWrite(pinArr[col][j],colof);}
digitalWrite(pinArr[row][i],rowof);
}
}
}
``````

As you can see, I’m using most of the pins there…so I guess the implementation is different?

ok well my code is designed to use the very cheap and easy to use 74HC595 shift register. However, it could be adapted to be used without them.