##############################################################
# Neopixel WS2812 LED Interface #
##############################################################
#
# Neopixel WS2812 LED interface with Raspberry Pi Pico / W / 2 / w2 (Hardware & Simulation)
#
# Check out the link for Code explanation and Hardware details
# Link:
# http://tech.arunkumarn.in/blogs/raspberry-pi-pico/beginner-guide-to-programming-neopixel-rgb-leds-with-pico-and-micropython/
#
#
from machine import Pin
import time
from neopixel import NeoPixel
pin = Pin(21, Pin.OUT) # set GPIO 21 to output to drive NeoPixels
np = NeoPixel(pin, 16) # create NeoPixel driver on GPIO 21 for 16 pixels
colors = [(255, 0 , 0), (0, 255, 0), (0, 0, 255), (255, 169, 0), (255, 255, 255)]
for color in colors:
for i in range(16):
np[i] = color
np.write()
time.sleep_ms(100)
time.sleep(1)
for color in colors:
for i in range(15, -1, -1):
np[i] = color
np.write()
time.sleep_ms(100)
time.sleep(1)