Hi all,
I have created for the NodeMCu equipped with a Nokia 5510 LCD an animation of Muybridge's galloping horse (see picture) (sketch attached). The horse, named Sallie Gardner, is happily running for an Olympic gold medal. A Nokia display is fast enough to support rapid successions of image frames; I even had to include a delay (=interframeTime) of 180 millis to slow it down - else Sallie's legs tend to turn into a Road Runner dust cloud.
So the animation runs good, no problem with that. It is the programming that might be improved.
The animation consists of 10 frames (bitmaps, in progmem) which are printed in rapid succession to screen, here a modest 84*48 pixel Nokia 5510 LCD). The setup is in the picture:
Frames loaded in progrem are named horse_01, horse_02, horse_03, etc till horse_10.
I created the rapid succession of frames by composing 10 successive lines of instructions which only differ in the frame number that is being called:
display.drawBitmap (0, 0, horse_01, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_02, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_03, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_04, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_05, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_06, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_07, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_08, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_09, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
display.drawBitmap (0, 0, horse_10, 80, 48, 1); display.display(); delay (interframeTime); display.clearDisplay ();
My question: this seems to me as nine redundant lines of instructions. I wonder whether this can this be done with one simple - for next- or -while - loop and with indexed horse_ frame calls? I welcome suggestions.
--Thanks, Photoncatcher
