Does anyone have a link to simple code examples (been googling for 2 days with no success) of getting text to scroll on 2 or more 8x8 LED matrices via MAX7219 chip (i.e using LEDControl library). I went thru all the basic tutorials on MAX72xx and LEDControl, and successfully got 2 of the matrices working, just not sure how to do the animation code...

I just realised that these two code examples do not use Ledcontrol library so when I get home from work I will see what else I have found online and post the link or code for them. But in the meantime -

Scrolltest2 .ino, by Riva on this forum, is attached to the fourth post in this thread http://arduino.cc/forum/index.php/topic,123787.msg939503.html#msg939503

This code by JoeN on this forum. It is attached to the sixth post of this thread http://arduino.cc/forum/index.php/topic,115559.0.html. It is a .ino.txt file for some reason, so I just renamed it as a .ino and opened it with Arduino IDE.

Pedro, thank you SOOOOOOOOOOOOOOOOOOOOOOOOO much!!!!! This is just what I was looking for, I don't know how I missed that thread (115559), it's basically what I'm trying to do, it's perfect! I'm digging into the code now, can't wait to go home and try it out!!!

dhenry, that's a good tip. I wanted even more basic information tho, how actual scrolling would work? I thought about it and it seems that I need to shift each column of bits to the side. So if top of the letter A is "00111100", I'll need to make it into "01111000", and then "11110000". Then it will start to wrap around " "01110001". So how would I do this "byte shifting" programatically with for loops, etc.? At this point I have no idea, but hopefully I can figure out it from the examples that Pedro showed me.

Say that your image is arranged in columns. So display_buffer[0] contains the left most column, and display_buffer[7] contains the right most column. In each column, bit 0 is the top dot and bit 7 is the bottom dot.

Excuse me Mr dhenry , I am also trying to learn the basic concepts of scrolling characters etc on Arduino and although there is a lot of information around I am still finding it a "hard road" as there is a lot of jargon involved… it's like trying to join a secret society of ninja warriors. So am I correct in assuming that a buffer is an array containing columns of zero's and one's which form the character or symbol you wish to display and scroll. Do you then maybe use a for loop to move through this buffer array? There seem to be numerous methods of scrolling but for someone trying to learn from basic principles upwards, it's a battle. Any help would be appreciated as there does not seem to be any tutorials available anywhere.

So am I correct in assuming that a buffer is an array containing columns of zero's and one's which form the character or symbol you wish to display and scroll. Do you then maybe use a for loop to move through this buffer array?

There are two basic types of displays:

1) write-only displays: they are either dumb (controller-less. as segment lcd / led), or they cannot be read back (many low-end graphics leds are like that). For those displays, you can either write-over what's on the screen, or keep a copy of the screen in your memory and process it before sending the data over to the screen. If you need anything fancier, you need to keep a local copy of the screen. Thus a buffer.2) read/writable displays: you don't have to keep a local copy of the screen, as you can always read it back from the screen. However, that reading back / forth can take more time so for speed reasons, you may see people using buffers as well.

Buffers are nothing but a dedicated area in the mcu's ram that keeps track of what's being displayed. Each dot is represented by a bit (in an on/off only screen), or a gray / color scale.

In the case of MAx72xx, since you need to scroll the image, you have to have a buffer.

Once you have a buffer, you can process every bit / led based on your desired actions. The code I provided earlier shows some of the more generic ways for you to do that. You can actually speed it up significantly if you use memory copy. It serves as a starting point.

Thanks for that concise explanation. If I may ask, how did you / and guys/girls on this forum learn about coding to scroll etc. I try to look at different examples and work out how they are doing it but good information on the subject is hard to find. I know that quite a few of you have a solid background in computing but for me its only what I can find online and from help by the generosity of people on this forum. Thanks again for your help

Emdedded programming is hard as it combines both software and hardware, analog and digital.

In this case, you will need to figure out how the hardware is arranged: whether the image is row based or column based, etc. Once you have that set, all you need to do is to figure out how to move the image to get your desired effect and how to code to move that image.

What I found important is to be able to modulize your tasks and figure out a way to easily integrate them back into a workable project. Many of the code pieces out there have all the tasks co-mingled and that makes them useless for your project.

Once you have modulized your code, you can use them in future projects, speeding up the development cycle.

Thanks so much for that simple statement "embedded programming" It is the first time during all my internet research into learning to code (specifically Arduino scrolling text) that it has been given a name pointing me to an specific sub genre of programming. All I seem to have read is how easy it all is and it is starting to give me a complex thinking that "I am a bit slow on the uptake" After googling enbedded prog I am at least finding specific information so thanks again Pedro.

I've made some progress. Example program "LCDemoMatrix" that came with LedControl library had a very clear structure so I can understand it easy (not so much luck with other examples). I realized that characters were stored "sideways" i.e. letter "A" is defined as:

byte a[8]={B00000000,B01111111,B10001000,B10001000,B10001000,B10001000,B01111111,B00000000};Well I made it bigger and 8x8. So it's very easy to scroll by just moving starting row. So as dhenry mentioned it depends how your text stored (column vs. row) and I think how your LED matrix arranged physically (at which side they touch). So I think in the LedControl they use column-wise text, and other examples on this forum used "row-wise" fonts.Anyway, I had to do this from scratch so I came up with this way to scroll it on a single matrix:

for(int j=pos;j<8;j++){ // This first for loop will shift position of the row for(int i=0;i<8;i++) { // This second loop will display character lc.setRow(screen,i+j,a[i]); // Display character } delay(100); // speed of animation } pos = -8; // From this point character will advance from "beyond" screen}

"pos" variable is initially set to 0, so character will start from the middle of the matrix, but then it will always "flow" from the side. Screen specifies which matrix device to address. Don't forget you need to initialize and define them in the beginning (see orignal LCDemoMatrix example).I'm not quite sure why it works, and how library handles negative rows, but it works Of course this is very rough code, and animation doesn't wrap around or continues smoothly to the next screen, but I think I can figure it out. Oh and I didn't use buffer at all yet....I'll keep this thread updated if anyone find it interesting.

My approach is to maintain the buffer and always starts at column 0 and finish at column 7 of that buffer. Your approach is is to start with a column, and then wrap around back to it.

My approach involves a lot of data moving around, but is otherwise more flexible - coding a combination move is fairly easy. Your approach involves no data movement, but can be tough to code complex movements.

As to how your code work, think of it having two pieces:

1) Remember the start column in your image buffer (a[] in this case), in col_start;2) for each frame, display columns from col_start to 7; and then display columns from 0 to col_start - 1;3) advance col_start.

void letter_scroll(){ // Define "A" Character columnwise orientation byte a[8]={B00000000,B01111111,B10001000,B10001000,B10001000,B10001000,B01111111,B00000000}; int matrix_rows=8; // Specify number of LEDs in a row of the matrix int screen_res=lc.getDeviceCount()*matrix_rows; // Define Screen resolution (lengh) by getting number of devices connected and rows in each matrix (i.e. 2x8=16) int row=0; // Var will only be used on first screen to do wrap around function for(int j=0;j<screen_res;j++){ // This will shift position of the row creating movement for(int i=0;i<8;i++) { // Render Character on Screen 1 if (j>8){ //we beyond first screen if (j>matrix_rows){ // Time to wrap around row=j-screen_res; // Modify start position so it goesn't go beyond screen lc.setRow(0,i+row,a[i]); // Render Letter } } else{ // We are on the 1st screen lc.setRow(0,i+j,a[i]); // Render Letter } } for(int i=0;i<8;i++) { // Render Character on second screen if (j>0){ // Are we scrolling off the prev. screen? lc.setRow(1,i+j-8,a[i]); // Render Character on second screen } } delay(100); // speed of animation } }

Hi Bratan, thanks for sharing your progress, I for one would appreciate you sharing any and all of your forays into "Arduino Scroll World" Now I cannot wait to get home after work and look at your discoveries,