Create CPX-NeoPixels.py

Code to show how to use the ten NeoPixels on the Circuit Playground Express in the context of using NeoPixels with Crickit
This commit is contained in:
Mike Barela 2018-07-16 12:47:15 -04:00 committed by GitHub
parent 2c99d3a27b
commit b4d69f4e93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,23 @@
# Use the 10 NeoPixels on Circuit Playground Express via the
# Adafruit neopixel library
import time
import neopixel
import board
# Set up the 10 Circuit Playground Express NeoPixels half bright
CPX_pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.5)
# slowly power up via blue color
for i in range(50):
CPX_pixels.fill((0, 0, i))
time.sleep(0.05)
# blast off!
CPX_pixels.fill((255, 0, 0))
while True:
# pulse effect
for i in range(255, 0, -5):
CPX_pixels.fill((i, 0, 0))
for i in range(0, 255, 5):
CPX_pixels.fill((i, 0, 0))