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:
parent
2c99d3a27b
commit
b4d69f4e93
1 changed files with 23 additions and 0 deletions
23
Make_It_Glow_With_Crickit/CPX-NeoPixels.py
Normal file
23
Make_It_Glow_With_Crickit/CPX-NeoPixels.py
Normal 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))
|
||||
Loading…
Reference in a new issue