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.brightness = 1.0
>>> cpx.pixels[0] = (255, 0, 0)
  1. At this point, the first pixel should be the color red with full brightness. Run the following line of code to set the brightness level to 50%:
>>> cpx.pixels.brightness = 0.5
  1. The brightness level can be brought further down to 10% and still be comfortably visible. You can do this by running the following line of code:

>>> cpx.pixels.brightness = 0.10