There's more...

The following photograph shows the rainbow animation from this recipe running on the Circuit Playground Express:

There are many ways to make further derivative animations from this rainbow animation. For instance, you could add more colors that are not part of the natural rainbow. We have defined 7 colors but there are 10 pixels on the board, so you could define another 3 different colors. You could also have the starting pixel be randomly selected in each loop, so that the animation starts at a different pixel in each loop.

Get MicroPython Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.