Onboard NeoPixels:
Set each LED individually
import board
import neopixel
from time import sleep
import random
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
PURPLE = (128, 0, 128)
NUM_LEDS = 10
PIXEL_PIN = board.D8
np = neopixel.NeoPixel(PIXEL_PIN, NUM_LEDS, brightness=0.1, auto_write=False)
def ColorWheel(new_color):
for i in range(NUM_LEDS):
np[i] = new_color
np.show()
sleep(0.2)
while True:
red = random.randint(0, 255)
green = random.randint(0, 255)
blue = random.randint(0, 255)
next = (red, green, blue)
print("Displaying", next)
ColorWheel(next)
sleep(0.5)