Created
June 4, 2024 23:07
-
-
Save gallaugher/dad49d3678b063603c91b8fd28071465 to your computer and use it in GitHub Desktop.
cpb-neopixels.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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