Direct Drive 8X8 example from playground

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:

  1. since the data is a type of byte, do i need all 8 bits? is trimming it the way I did causeing the issue?
  2. Im not familiar with C syntax, so the "" at the end of each line, is that a line continuation character?
  3. 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.. :slight_smile:

I appreciate the help very much in advance, and thank everyone who helped me determine the interfacing requirements for the hardware side!

well, I came home, and changed it to simply keep the shape only using 5 of the 8 bits there, (leaving the others turned off), and played a bit more with pinouts, and got it working without modifying the code.

Now to try to get a font library, compress it into a 5x5, and see if I can use what I have to drive off someone else's work instead of having to fiddle with 1s and 0s so much :slight_smile:

Thanks everyone! (Wish I could post vids.. no camera SIGH)

Excellent! I was going to try and help you, but you beat me to it (that was my hacked up example). Just beware of burning stuff out if you're not using any resistors.

Andrew

I added some current limiting resistors to my breadboard so that's all good..

My todo is :

  1. figure out how to make the text scroll UP instead of side to side (just to see if I can -- alot harder than I thought at first Thought it was incrementing/decrementing the 'j' element of the array inside the slidePattern routine instead of the 'i' element... gotta go back to the drawing board on that one. )
  2. Again, figure out how in the world to make the font manipulation a bit easier
  3. figure out how to, instead of simply manipulating a bit of code setup to use 8x8, port it to a direct drive of 5x5

IM SO GLAD to be able to do something with this, for no more than the cost of the .99 resistors, the arduino, and a salvaged matrix from a .10 "broken" toy from a thrift store... now to get an understanding of how it works, rather than just MAKING it work..

If you haven't seen it already then you might find this thread useful: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1203747843/15

Someone kindly adapted the code to use much less memory by storing the font pixels as bits of a byte rather than a byte each - he also changed it to 5x7 pixel letters which should interest you.

I also put some explanation in there of how my original code works, which may or may not help you in understanding it...

Andrew

Andrew,

First off, thank you for even taking the time to publixh the code in the first place. Your code helped me finally "Do Something" with my arduino, which was a HUGE help - and gives me someplace to start from while learning.

Second off, it doesnt seem like enough, but Thank you also for continuing to help me!

You're very welcome. If this forum and the playground hadn't existed and been full of people willing to help I wouldn't have got very far myself. Hoorah for the internet and all the helpful people that inhabit it!

I've been having a bit of break from Arduino things recently, but having just gutted an old HP Deskjet for the stepper motors I might re-embark on my quest to build a desktop CNC mill. Trouble is hardware requires stuff to fit together and work right within tolerances - software's easy by comparison...

Andrew