Rotating a an image clockwise on a LED Array

I am currently playing around with a 5x7 LED array and want to make my image to rotate clockwise continually when the sketch is uploaded. Right now I am able to make the image move from left to right. Could you help me out on figuring our how to rotate the image. Thank you!

Scroll_practice.ino (2.04 KB)

See if this helps. Turn led 1 on, turn led2 on, turn led 1 off, turn led3 on ..etc. Reverse the order for the opposite direction.

If You had an 8 by 8 matrix it had been easy...

I suggest that You store the original picture for further use.
Than make a copy an calculate how to make 5 pixels go to 7, and how to make 7 pixels translated into 5 pixels, assuming 90 degree rotation.

You'll need to practise some geometry....

If it’s straight 90-degree rotation, on an 8x8 matrix as mentioned, it’s easy (think modulo), but 5x7 means you have to choose what’s going to be trimmed off, and whether it has to be restored later with each change of rotation.

If you want incremental (not 90 degree) steps, it’s time to dig out the sin() and cos() hat. Resolution of angles will be rubbish on those low resolutions... you may be better off faking it with intermediate ‘sprites’ that ‘look like’ animation.

lastchancename:
If it’s straight 90-degree rotation, on an 8x8 matrix as mentioned, it’s easy (think modulo), but 5x7 means you have to choose what’s going to be trimmed off, and whether it has to be restored later with each change of rotation.

If you want incremental (not 90 degree) steps, it’s time to dig out the sin() and cos() hat. Resolution of angles will be rubbish on those low resolutions... you may be better off faking it with intermediate ‘sprites’ that ‘look like’ animation.

How would this look like inside of a for loops? Would I need multiple loops and an if/then statement as well?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.