Skip to content

Instantly share code, notes, and snippets.

@BenjaminSantiago
Last active September 22, 2021 06:08
Show Gist options
  • Save BenjaminSantiago/8be96595a03b8f4b3a30b4911215246e to your computer and use it in GitHub Desktop.
Save BenjaminSantiago/8be96595a03b8f4b3a30b4911215246e to your computer and use it in GitHub Desktop.
Turning on all neopixels on the CPX
"""
In this example we will turn on all the neopixels in the CPX
"""
# --------------------------
import time
from adafruit_circuitplayground import cp
# --------------------------
# --------------------------
while True:
# use this function to access the pixels and fill them all one color\
# white
# fill has two parentheses, because a list of values in
# parenthesis is called a "tuple"
cp.pixels.fill((255, 255, 255))
time.sleep(0.3)
# red
cp.pixels.fill((255, 0, 0))
time.sleep(0.3)
# green
cp.pixels.fill((0, 255, 0))
time.sleep(0.3)
# blue
cp.pixels.fill((0, 0, 255))
time.sleep(0.3)
# purple
cp.pixels.fill((255, 0, 255))
time.sleep(0.3)
# a rando color that idk what
# it will look like
cp.pixels.fill((184, 91, 32))
time.sleep(0.3)
# --------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment