Created
April 27, 2023 20:07
-
-
Save lizzybrooks/5566e7991cd4e936ec358f4279884766 to your computer and use it in GitHub Desktop.
This file contains 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
import time | |
import board | |
import neopixel | |
pixel_pin = board.D2 | |
num_pixels = 16 | |
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.1, auto_write=False) | |
RED = (255, 0, 0) | |
YELLOW = (255, 150, 0) | |
GREEN = (0, 255, 0) | |
CYAN = (0, 255, 255) | |
BLUE = (0, 0, 255) | |
PURPLE = (180, 0, 255) | |
WHITE = (255, 255, 255) | |
OFF = (0, 0, 0) | |
COLOR = WHITE | |
while True: | |
for c in range(0, 5, 1): | |
if (c == 0): | |
COLOR = RED | |
if (c == 1): | |
COLOR = YELLOW | |
if (c == 2): | |
COLOR = GREEN | |
if (c == 3): | |
COLOR = CYAN | |
if (c == 4): | |
COLOR = BLUE | |
if (c == 5): | |
COLOR = PURPLE | |
for i in range(0, 16, 1): | |
pixels[i] = COLOR | |
pixels.show() | |
time.sleep(0.1)# Write your code here :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment