from machine import Pin
from neopixel import NeoPixel
import time
strip_lenght = 6
pin = Pin(14, Pin.OUT) # set a pin to output to drive NeoPixels
leds = NeoPixel(pin, strip_lenght) # create NeoPixel driver on pin for 8 pixels
# set the starting pixels
leds[0] = [255,0,0]
leds[3] = [0,255,0]
leds[6] = [0,0,255]
#main loop
while(1):
for index in range(strip_lenght):
if index == 0:
remeberLast = leds[strip_lenght - 1]
leds[strip_lenght - 1] = leds[0]
elif index == strip_lenght - 1:
leds[index - 1] = remeberLast
else:
leds[index - 1] = leds[index]
leds.write() # write data to all pixels
time.sleep(0.5) # sleep 0.5s before moving again