2022-10-12 18:20:32 +01:00
|
|
|
import plasma
|
2022-10-18 13:13:57 +01:00
|
|
|
from plasma import plasma_stick
|
2022-10-12 18:20:32 +01:00
|
|
|
import time
|
|
|
|
from random import random, uniform
|
|
|
|
|
|
|
|
"""
|
|
|
|
A basic fire effect.
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Set how many LEDs you have
|
|
|
|
NUM_LEDS = 50
|
|
|
|
|
|
|
|
# WS2812 / NeoPixel™ LEDs
|
2022-10-19 16:31:36 +01:00
|
|
|
led_strip = plasma.WS2812(NUM_LEDS, 0, 0, plasma_stick.DAT, color_order=plasma.COLOR_ORDER_RGB)
|
2022-10-12 18:20:32 +01:00
|
|
|
|
|
|
|
# Start updating the LED strip
|
|
|
|
led_strip.start()
|
|
|
|
|
|
|
|
while True:
|
|
|
|
# fire effect! Random red/orange hue, full saturation, random brightness
|
|
|
|
for i in range(NUM_LEDS):
|
|
|
|
led_strip.set_hsv(i, uniform(0.0, 50 / 360), 1.0, random())
|
|
|
|
time.sleep(0.1)
|