xxxxxxxxxx
# load libraries
from machine import Pin
from neopixel import NeoPixel
from utime import sleep_ms
# GPIO-Pin for WS2812
pin_np = 28
# number of LEDs
leds = 8
# Brightness: 0 to 255
brightness = 10
# Speed (milliseconds)
speed = 50
# Initializing WS2812
np = NeoPixel(Pin(pin_np, Pin.OUT), leds)
while True:
for i in range (leds):
# Turn next LED on
np[i] = (brightness, brightness, brightness)
np.write()
sleep_ms(speed)
# reset LED
np[i] = (0, 0, 0)