# LT2 RGB Spectrum (make sure to use a list)
from picozero import RGBLED
import time
from time import sleep
rgb = RGBLED(3, 2, 1)
# r, g, b
# holding RGB values, white, red, green, blue, yellow, cyan, purple
colors = [(255, 255, 255), (255, 0 ,0), (0 ,255, 0), (0, 0, 255), (255, 255, 0), (0, 255, 255), (255, 0, 255)]
words = ("White", "Red", "Green", "Blue", "Yellow", "Cyan", "Magenta")
# alone variables (c & w) and "in range(len(list))" is for indexes in said list
# variables with their corresponding list (colors[c], words[w]) and "for in list" prints items in said list
print("The Lovely Light Spectrum:")
sleep(1)
for c in range(len(colors)):
for w in range(len(words)):
if c == w:
rgb.color = colors[c]
print(words[w])
sleep(1)
rgb.off()
Loading
pi-pico-w
pi-pico-w