Challenge

This will be one of the hardest challenges in the book. The Keyestudio NeoPixel shield has eight columns of pixels where each column contains five pixels where the pixels are numbered like this:

For the challenge, set each column to a different color and have the colors rotate from left to right across the shield. Here are a couple of hints to get you started. The first is the Adafruit NeoPixel library, which has a function named Color() that will return the 32-bit color based on the three red, green and blue values. Therefore, you can use the following code to convert an 8-bit number to the 32-bit color.

uint32_t colorNum(int color) ...

Get Mastering Arduino 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.