Skip to main content

NeoPixels - RGB LEDs

For basic information on NeoPixels and RGB LEDs, refer to this great tutorial from Adafruit

import time
import board
import neopixel
import rainbowio

# Hardware definition: GPIO where RGB LED is connected.
pixel_pin = board.P0_15
num_pixels = 8

pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)

def rainbow_cycle(wait):
for j in range(255):
for i in range(num_pixels):
rc_index = (i * 256 // num_pixels) + j
pixels[i] = rainbowio.colorwheel(rc_index & 255)

while True: