pimoroni-pico-rp2350/micropython/examples/plasma_2350/rainbow.py
2024-08-09 13:43:49 +01:00

28 lines
540 B
Python

import plasma
from plasma import plasma2040
import time
# Set how many LEDs you have
NUM_LEDS = 50
# APA102 / DotStar™ LEDs
# led_strip = plasma.APA102(NUM_LEDS, 0, 0, plasma2040.DAT, plasma2040.CLK)
# WS2812 / NeoPixel™ LEDs
led_strip = plasma.WS2812(NUM_LEDS, 0, 0, plasma2040.DAT)
# Start updating the LED strip
led_strip.start()
offset = 0.0
while True:
offset += float(10) / 2000.0
for i in range(NUM_LEDS):
hue = float(i) / NUM_LEDS
led_strip.set_hsv(i, offset, 1.0, 1.0)
time.sleep(1.0 / 60)