Go Down

Topic: Sketch examples of scrolling text on 8x8 LED matrix w/ MAX72xx (Read 15 times) previous topic - next topic


Oct 20, 2012, 11:44 pm Last Edit: Oct 20, 2012, 11:59 pm by Pedro147 Reason: 1
Thanks Riva, I don't know how I missed that scroll speed code. Nice touch with the code allowance for varying char widths. It's attention to detail like that that differentiate good from "top shelf" IMHO  8)
Edit - where would I / we be without Google "Kerning is an adjustment of the space between two letters" If I may ask you Riva since you obviously have a long career in programming. How does someone new to all this, learn coding particuarly with Arduino in mind. The general consensus on the forum seems to be to work through all the projects from simple to complex but from how I see it, I feel that there is a better way. Along with progressively trying more complex projects and looking at the code and trying to see how it works, I am doing a little online study in C++.  What are your thoughts if I may.


And I'm done! more or less :)
I wrote simplified code (as my C++ knowledge is poor), but it works with my setup of 2 matrix displays!
As I was trying to adopt other people's code (Riva yours is brilliant, but didn't work in my hardware arrangement) I realized that I wired my matrices different from most setups. Pins go in one long row (i.e. Pin 12 of matrix 1 is next to Pin 1 of matrix 2), and I actually think this setup easier to wire on breadboards (probably the only way to wire on breadboard) so I'm at loss to understand why mine don't work the same, maybe I wired it different (after all I had to figure out pinouts becuase I had no datasheet, and these are not the same as more popular Sure's displays).
Anyway it doesn't matter, as I figured out code and algorithm of animation. Writing code from scratch is a great educational experience, but it took me almost a week :(
It currently works great with 2 devices, but I'm not sure how much modification will be needed to support 3 or more, I will try to enhance it later to see if I can make it universal for any number of displays.
Code: [Select]
Here's my algorithm:
B1 bufer 1
B2 bufer 2
NextChar = Font of next character
1. Fill Buffer B1
2. Begin Loop . If Looped for 8 times, go to 11
3. Display B1
4. Display B2 (it's empty 1st time)
5. Rotate B1: B1[7]=B1[6], B1[6]=B1[5]...B1[1]=B1[0], B1[0]=NextChar[7]
6. Rotate B2: B2[7]=B2[6], B2[6]=B2[5]...B2[1]=B2[0], B2[0]=B1[7]
7. Display B1
8. Display B2
9. Delay (animation delay)
10. Go To 2 (End Loop)
11. Go to 1

I'm also attaching code (it has font file as well in the rar archive), feel free to use and modify it.
I know font is crappy, I had to do everything from scratch because my characters are rotated 90CCW. Pial's web based 8x8 matrix font generator helped a lot!  I will draw a prettier font in the future :)  I would use other's people nice fonts, if someone can suggest how I can rotate them 90 CCW.
I'm also attaching image that shows how animation works in my code.
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)


Oct 21, 2012, 07:25 pm Last Edit: Oct 21, 2012, 07:30 pm by CrossRoads Reason: 1
Got my first youtube video loaded!


Scroll test of 8x32 LED matrix. Can hold up to 233 characters in SRAM. Will be ~40 more once I push 5x8 fonts out to PROGMEM.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.


Lookin' good there CR  8) Once I build up my 8 x 32 board that I have been planning for a while now, I would love to try your code. Its amazing how many people are "scared" of SPI


Well done for getting it sorted.
It currently works great with 2 devices, but I'm not sure how much modification will be needed to support 3 or more, I will try to enhance it later to see if I can make it universal for any number of displays.

The advantage of the way you address the MAX7219 is for scrolling you only need to add 1 byte from the vertically defined font to scroll where with the horizontal way I used you need to do a lot of AND & OR on 8 bytes to achieve the same thing. The current code I use could theoretically do 24x8 matrix with little modification but to go beyond that needs a bit more work. The vertical font way is a lot easier to expand to larger matrix arrays and could scroll a lot faster. I like the idea of using the 8x8 matrix blocks, beats the hell out of hand soldering 128 individual LED's. I might be tempted to do a smaller wordclock using these.

Go Up