MAX72XX 7 segment display LedControl

I have a setup with a MAX7221 and 8 digits of 7 segment displays
I use the LedControl library, and it all works.
I have edited the LedControl.h file, so I can use all characters in the alphabet.

I want to have a text scrolling from left to right
I use this code:

char text[] = "hello earth"; //should be world, I know, but W doesn't really work on a 7 segment display

    for (int num = 0; num <= sizeof(text)-1; num++) {

It scrolls like I want to, but between each time it scrolls, other characters are added.

don’t pay attention to the minus in stead of pluss (text[num-1])
I must have wired the digits in reverse order, but it just means that digit 0 is to the left

any suggestions?


I imagine the data is coming from a larger array somewhere - so wouldn't you want num to be changing where it is starting from? Or allowing for it wrap around?
8-15, 0
9-15, 0,1

the array is just the line at the top,
char text = "hello earth";

but yes, the characters come from a large array in the LedControl.h file

It seams like its "skipping"
this is what is scrolling : hello earth011103hello earth etc.
I have no idea why it puts in the 011103 between

wrap around sounds like a good idea

do you have a code suggestion for ho that would look?


You have to figure out your pointer scheme, that's all.
Right now you go from 0 to (size of the array) + another 7, where random stuff is read from memory & displayed. So you need to from 0 to (size of array less 7) and then wrap around for example.
Think about it some, see what you can come up with.

I have tried lots of things now, and tried to find out about “pointer scheme” and “wrap around”
I just can’t figure it out

do I need another forward loop with another int?

I have changed the code to make it simpler

char text[14] = "_hello_earth_";

void scrollText(){
    for (int i = 0; i <=14; i++) {

I just have no idea about how to “wrap it around”
could you please give me a clue :slight_smile:

Here is how I did it for a largish display, 32 columns. I had 2 variables that kept track of where in a much larger array the data was coming from (like 1000+ columns, experimented to see how big I could go before the program crashed) and where the end of the message being displayed was (because not all 1000+ columns were used all the time).
Altho looking at this now, I probably just used some blank columns at the end to let the message scroll off and then restarted the display Near the first column, I didn't like having at the very beginning as the first letter scrolled off display too quickly.

// e_time_check

// see if time to scroll the display, or change pointer for other move command
// move start pointer within the array

// time check
currentMillis = millis();
if ( (currentMillis - previousMillis) >= holdDuration && (move_control == normal)){ // lets update!
  previousMillis = previousMillis + holdDuration;  // time check for next pass
  updateDisplay = 1;
  // Serial.println("time check");
  // move start of display pointer
  // add some serially-sent control characters to manually move left, right, & hold for testing

  displayStart = displayStart +1;
  // calculate end based on (# of characters * 6), 5 byte font + space 
  if (displayStart == (displayEnd +1)){  
    displayStart = 2; // reset once reach the end
} // end time time check