Merging two sketches from same lilrary MD_MAX72xx

Hi every one!

I am trying to merge the two arduino examples MD_MAX72xx _Test and
MD_MAX72xx_DaftPunk in one single sketch ( one after the other )

I read a lot in this forum and followed the correct steps,

I successfully put together the two sketches and NO errors when I compile.However when I Upload my

sketch to the matrix ,only one sketch is playing (MD_MAX72xx _Test) !!

Can someone help me on this please?

Here I attached the combined sketch.

Thank you.

Merge.ino (41 KB)

Congratulations on combining the two codes. That is a good first step.

The problem you are encountering is that runMatrixAnimation() was designed to be used in loop all by itself and called many times each second. As you have the structure now, it is called once when the MD_Test code is run and then MD_Test runs again.

You will need to make the following changes:
change the function definition to

boolean runMatrixAnimation(void)

At the end of the function, you need to add in this line before the last closing brace ('}') to let the calling program know when the animations are all finished.

return(state == 0 && !bInMessages);

and in the loop() change the call to runMatrixAnimation to run until it has finished

while (!runMatrixAnimation()) ;

Please note I have not been able to test this so there may be a need for you to debug this.

Hi marco_c,

Thanks for taking time to look into my issue!

I did the corrections as you advised and

WOW, This is awsome, its working for me, this is what I wanted to do :slight_smile: .

I attached the final corrected sketch in case of one of the users will need to do the same !

Thanks again marco_c.

Merge.ino (41.1 KB)

ok. Good to hear.