from machine import Pin
from neopixel import NeoPixel
import time
pin = Pin(18, Pin.OUT) # set GPIO0 to output to drive NeoPixels
np = NeoPixel(pin, 8) # create NeoPixel driver on GPIO0 for 8 pixels
def chase_colors(speed):
colors = [
(255, 255, 55),
(255, 0, 55),
(255, 255, 0),
(255, 0, 55),
(0, 255, 55),
(255, 255, 55),
(255, 155, 55),
(25, 255, 255)
]
while True:
for i in range(len(np) - 1):
np[i] = colors[i]
np.write()
time.sleep(speed)
np[i] = (0, 0, 0) # turn off the current LED
np.write()
for i in range(len(np) - 1, 0, -1):
np[i] = colors[i]
np.write()
time.sleep(speed)
np[i] = (0, 0, 0) # turn off the current LED
np.write()
chase_colors(0.1) # Adjust the speed as needed