Skip to content

Commit 168094c

Browse files
authored
Add NeoPixel control code for CPX
Implement NeoPixel control for Circuit Playground Express with a pulsing effect.
1 parent bdd50e8 commit 168094c

File tree

1 file changed

+27
-0
lines changed
  • Crickits/Make_It_Glow_With_Crickit/CPX-NeoPixels

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
# Use the 10 NeoPixels on Circuit Playground Express via the
6+
# Adafruit neopixel library
7+
import time
8+
import neopixel
9+
import board
10+
11+
# Set up the 10 Circuit Playground Express NeoPixels half bright
12+
CPX_pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.5)
13+
14+
# slowly power up via blue color
15+
for i in range(50):
16+
CPX_pixels.fill((0, 0, i))
17+
time.sleep(0.05)
18+
19+
# blast off!
20+
CPX_pixels.fill((255, 0, 0))
21+
22+
while True:
23+
# pulse effect
24+
for i in range(255, 0, -5):
25+
CPX_pixels.fill((i, 0, 0))
26+
for i in range(0, 255, 5):
27+
CPX_pixels.fill((i, 0, 0))

0 commit comments

Comments
 (0)