Closed Pixelherz23 closed 2 years ago
Your attempt 1 is ok but it means the processor does not do anything other than print the words.
Attempt 3 is the most correct but you need to increment the index only when the animation has completed
if (P.displayAnimate())
{
if ((i%2) == 0) strcpy(curMessage, "hello");
else strcpy(curMessage, "world");
i++;
P.displayText(curMessage, Salgin, Sspeed, Spause, Seffect, Seffect);
}
You can see this technique being used in the Parola_Scrolling example.
Thanks alot.
I am not sure if I understand it correctly why the changing of curMessage
and P.displayText()
has to be in the if (P.displayAnimate()){}
.
Is it because otherwise the curMessage
changes too quickly and the display cant keep up with it?
displayAnimate() returns true when there is no animation running (ie, no started or just completed). So to change the message you wait until the animation is finished and then change the message and restart the animation.
curMessage is the memory where the message is stored. It is declared in the application and shared with the library to save RAM usage.
If you change the message while it is animating it will usually work - part of the 'old' message will be on the display and then part of the new message will be displayed after. The problems are when the new message is a lot shorter than the old and the current display point is beyond the end of the new message - the library will unpredictable things.
Please read the library documentation if you don't understand what a class method does. These are extensively documented. In the docs folder of the library, open the file index.html.
Thanks for the help! I am not used to C++ so much and since there are no tutorials for your library just copy and pastes of your examples, I am quite overwhelmed.
FYI someone on the Arduino forum (Arduino.cc) had this as a link for a tutorial on MD_Parola
https://lastminuteengineers.com/max7219-dot-matrix-arduino-tutorial/
I try to figure out how to display one text after another. After Attempt 1 worked flawless, I tried display the words with animations. Attempt 2 only prints "Hello" When using attempt 3 the words are mixed sometimes. Like "horld" or "wollo". Attempt 3 only prints "hello". I am new to this library. I looked up your blog and some other blogs/videos but I didnt found a explanation for changing the display text properly. :/