Im going to post this over here, as I believe its the best place to move forward in what IM doing... My C experience is very limited, however I program alot in java and other more obscure languages in my daily job, so im not a complete idiot (I hope :-[)
I am trying to take the example from the playground Arduino Playground - DirectDriveLEDMatrix and drive a 5x5 matrix with it instead of an 8x8.
I have identified which pins determine columns/rows, and now I am trying to trim down the patterns to fit within a 5x5 matrix.
I'll ask the following questions and we're going to assume I have the pins and cols/rows arrays assigned properly (Crosses fingers)
The first thing I did was go through and every reference to "8" changed that to a "5"....
then, in some of the for loops, there were some places a "7" was used.. I changed that to be 4 (assuming that being as the language was zero based, we were looking at one less than the max)
My question becomes the top where the #define statements are... What I saw was a matrix of 8x8 "Switches" (on/off bytes) and so I changed
#define SPACE { \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0} \
}
to this:
#define SPACE { \
{0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0} \
}
and it's not working at all correctly.
So that leaves me with the following questions:
- since the data is a type of byte, do i need all 8 bits? is trimming it the way I did causeing the issue?
- Im not familiar with C syntax, so the "" at the end of each line, is that a line continuation character?
- and assuming #2, is each set of bits within the individual braces an element in the array? Looking further into the code you see:
byte patterns[numPatterns][8][8] = {
H,E,L,L,O,SPACE
};
and Im kinda in the dark as to what part of that little declaration of an array fills BOTH elements IF of course it does.
Ultimately Ive been able to make SOME stufff happen with this code, Ive made the top two lines across the top of my matrix have 3 LEDs which are always on, and 2 which scroll from left to right...
(my ascii art skills arent good, but assume X = On, O = off, and S = Scroll from left to right)
S S X X X
S S X X X
O O O O O
O O O O O
O O O O O
While this is awesome, great, and even was exciting the first time, its really frustrating now, when I want so much more..
I appreciate the help very much in advance, and thank everyone who helped me determine the interfacing requirements for the hardware side!