MicroPython Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

To do this, perform the following steps:

  1. Run the following lines of code in the REPL:
>>> from adafruit_circuitplayground.express import cpx
>>> cpx.pixels[0:2] = [0xFF0000, 0xFF0000]
  1. You should see the first two NeoPixels light up as red.
  2. Turn the next three pixels to green and the last five pixels to blue using the following code:
>>> cpx.pixels[2:5] = [0x00FF00] * 3 
>>> cpx.pixels[5:10] = [0x0000FF] * 5