added some comments for clarification
+# 'Cyber falls' sketch
+# Creates a fiery rain-like effect on multiple NeoPixel strips.
+# Requires Adafruit Trinket and NeoPixel strips. Strip length is
+# inherently limited by Trinket RAM and processing power; this is
+# written for five 15-pixel strands, which are paired up per pin
+# for ten 15-pixel strips total.
+
import adafruit_fancyled.adafruit_fancyled as fancy
import board
import neopixel
import time
-from digitalio import DigitalInOut, Direction, Pull
-num_leds = 10 # number of LEDs per strip
+num_leds = 15 # number of LEDs per strip
saturation = 255 # 0-255, 0 is pure white, 255 is fully saturated color
blend = True # color blending between palette indices
-brightness = 0.1
-concurrent = 2
+brightness = 0.5 # half brightness the range is 0.0 - 1.0
+concurrent = 2 # number of LEDs on at a time
on_time = 0.04 # 40ms
# initialize list with all pixels off
@@ -24,18 +30,19 @@ drop4 = neopixel.NeoPixel(board.D4, num_leds)
# list of strips
drop_list = [drop0, drop1, drop2, drop3, drop4]
-# FancyLED allows for assigning a color palette using these formats:
-# see FastLED - colorpalettes.cpp
def led_drops(strip):
+ # FancyLED allows for mixing colors with palettes
palette = [fancy.CRGB(150, 255, 150), # lighter green
fancy.CRGB(0, 255, 0)] # full green
for i in range(num_leds):
+ # FancyLED can handle the gamma adjustment, brightness and RGB settings
color = fancy.palette_lookup(palette, i / num_leds)
color = fancy.gamma_adjust(color, brightness=brightness)
strip[i] = color.pack()
+ # turn off the LEDs as we go for raindrop effect
if i >= concurrent:
strip[i - concurrent] = (0,0,0)
@@ -49,5 +56,6 @@ def led_drops(strip):
while True:
+ # loop through each neopixel strip in our list
for strip in drop_list:
led_drops(strip)
