From the course: Learning CircuitPython with Circuit Playground Express

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

NeoPixels advanced programming

NeoPixels advanced programming - Python Tutorial

From the course: Learning CircuitPython with Circuit Playground Express

Start my 1-month free trial

NeoPixels advanced programming

- [Instructor] In this video, we'll learn some new CircuitPython language features, and code a more advanced NeoPixel effect. This new effect simply assigns three colors sequentially to the 10 pixels. But since three doesn't go evenly into 10, each time around the 10 NeoPixels, the colors shift by one until after the third time around the colors are back to the way they started. This is easier to program than it might seem. The basic algorithm is to first set up the colors and start at pixel zero. Then, loop getting the next color and putting it in the next pixel. We'll go to the desktop to see how to code this, but first there are a few new ideas to cover. You saw in the intro to NeoPixels that you could assign colors to variables. You can also create a list of those color variables. Once the colors are in a list, you can refer to them using their index. The first item in the list is index zero. Another nice feature of…

Contents