上QQ阅读APP看书,第一时间看更新
How to do it...
To do this, perform the following steps:
- Run the following lines of code in the REPL:
>>> from adafruit_circuitplayground.express import cpx >>> cpx.pixels[0] = 0xFF0000
- You should see the first NeoPixel turn red. Run the following code to retrieve the color value of the first NeoPixel:
>>> cpx.pixels[0] (0, 0, 255)
- Run the following code to set the next two pixels to green and blue:
>>> cpx.pixels[1] = 0x00FF00 >>> cpx.pixels[2] = 0x0000FF
- Use the following code to set the fourth pixel to yellow:
>>> cpx.pixels[3] = 0xFFFF00
- Use the following code to display the integer value for the color blue, and then set the next pixel to the color blue using this integer value:
>>> 0x0000FF 255 >>> cpx.pixels[4] = 255