Skip to content

Instantly share code, notes, and snippets.

@gallaugher
Created June 4, 2024 23:07
Show Gist options
  • Save gallaugher/dad49d3678b063603c91b8fd28071465 to your computer and use it in GitHub Desktop.
Save gallaugher/dad49d3678b063603c91b8fd28071465 to your computer and use it in GitHub Desktop.
cpb-neopixels.py
# Turn on CircuitPlayground's NeoPixels, 1 at a time,
# then turn them off one at a time in the opposite direction
import time, board, neopixel
# Create the object named pixels so we can work with the CPB's lights
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
# Define the colors named BLUE and BLACK
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
# Print a message
print("CircuitPython on PyCharm is Fantastic!")
# Repeat forever while running
while True:
pixels.fill(BLUE) # Turn all lights blue
time.sleep(1.0) # Wait one second
pixels.fill(BLACK) # Turn all lights black
time.sleep(1.0) # Wait one second, then restart after while True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment