from machine import Pin
from neopixel import NeoPixel
from utime import sleep_ms
numpix = 24
np = NeoPixel(Pin(7), numpix)
b = 128 # brightness; 255-full, 128-half, 64-quarter
t = 50 # time [ms]
# ---------------------------------------------------------------------
template1=[(b, 0, 0), (b, 0, 0), (b, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, b, 0), (0, b, 0), (0, b, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, b), (0, 0, b), (0, 0, b), (0, 0, 0), (0, 0, 0), (0, 0, 0), (b, b, 0), (b, b, 0), (b, b, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)]
template2=[(b, 0, b), (b, 0, b), (b, 0, b), (b, 0, b), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, b, b), (0, b, b), (0, b, b), (0, b, b), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (b, b, b), (b, b, b), (b, b, b), (b, b, b), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)]
# ---------------------------------------------------------------------
while True:
for _ in range(numpix): #--- shift right ---
template1 = template1[-1:] + template1[:-1]
for i in range(numpix):
np[i] = template1[i]
np.write()
sleep_ms(t)
for _ in range(numpix): #--- shift left---
template1 = template1[1:] + template1[:1]
for i in range(numpix):
np[i] = template1[i]
np.write()
sleep_ms(t)
# ------------------------------------------------------------------
for _ in range(numpix): #--- shift right ---
template2 = template2[-1:] + template2[:-1]
for i in range(numpix):
np[i] = template2[i]
np.write()
sleep_ms(t)
for _ in range(numpix): #--- shift left---
template2 = template2[1:] + template2[:1]
for i in range(numpix):
np[i] = template2[i]
np.write()
sleep_ms(t)