上QQ阅读APP看书,第一时间看更新
How to do it...
Let's have a look at how to do this:
- Make sure that the board is connected to your computer with a USB cable and that the CIRCUITPY drive appears.
- Save a text file on the drive with the following contents and name it main.py:
from adafruit_circuitplayground.express import cpx
import time
cpx.pixels[0] = (255, 0, 0) # set first NeoPixel to the color red
time.sleep(60)
- Once the file has been saved, eject the drive, and remove and reconnect the USB cable from the computer.
- The first NeoPixel on the drive should light up with a red color.
- Open the main.py file in your text editor of choice and change the cpx.pixels[0] line to cpx.pixels[1]. Save the file. This change will make the second NeoPixel light up instead of the first.
- Eject the drive, remove, and then reconnect the USB cable to see the change take effect.