Skip to content

Instantly share code, notes, and snippets.

View kriegsman's full-sized avatar

Mark Kriegsman kriegsman

  • Boston
View GitHub Profile
@kriegsman
kriegsman / TimedPlaylist.ino
Last active February 12, 2022 19:36
Timed playlist of animations, designed for sequencing and performance.
#include "FastLED.h"
// This sketch shows one way to define a 'timed playlist'
// of animations that automatically rotate on a custom schedule.
//
// A "ResetPlaylist" method is provided so that the playlist can be
// restarted from a custom external trigger, e.g., a button or event.
// For demonstration purposes, the playlist is reset if the
// sketch receives a letter "r" on the serial port.
//
@kriegsman
kriegsman / rgb2hsv_approximate.ino
Last active August 29, 2015 14:12
rgb2hsv_approximate: approximate recovery of HSV values from an RGB input
(Code added to FastLED3.1 branch... find it there.)
@kriegsman
kriegsman / Fireworks16x16.ino
Created December 31, 2014 17:04
2-D Fireworks simulation tuned for 16x16 matrix
#include "FastLED.h"
// Quick and dirty 2-D fireworks simulation
// Originaly designed (and tuned for) a 16x16 matrix
// by Mark Kriegsman, July 2013
// (and not updated since, so it's a little stale,
// but it's a good starting point, if rather uncommented.)
#define PIXEL_WIDTH 15
#define PIXEL_HEIGHT 16
@kriegsman
kriegsman / Fireworks5x8.ino
Created December 31, 2014 17:01
2-D fireworks simulation (originally designed and tuned for an 5x8 matrix, but scalable)
#include "FastLED.h"
// Quick and dirty 2-D fireworks simulation
// Originaly designed (and tuned for) an Adafruit 5x8 WS2811 shield
// by Mark Kriegsman, July 2013
// (and not updated since, so it's a little stale,
// but it's a good starting point, if rather uncommented.)
#define NUM_LEDS 40
CRGB leds[NUM_LEDS];
@kriegsman
kriegsman / PaletteCrossfade.ino
Last active March 2, 2024 01:37
How to cross-fade between color palettes using nblendPaletteTowardPalette
#include <FastLED.h>
#define LED_PIN 3
#define NUM_LEDS 30
#define BRIGHTNESS 96
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 100
@kriegsman
kriegsman / DemoReel100.ino
Last active January 24, 2025 17:24
FastLED "100-line" demo reel
#include "FastLED.h"
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
//
// This example also shows one easy way to define multiple
// animations patterns and have them automatically rotate.
//
// -Mark Kriegsman, December 2014
@kriegsman
kriegsman / ColorTwinkles.ino
Last active January 29, 2021 17:48
Twinkling 'holiday' lights that fade in and out.
#include "FastLED.h"
#define LED_PIN 3
#define LED_TYPE WS2811
#define COLOR_ORDER RGB
#define NUM_LEDS 50
CRGB leds[NUM_LEDS];
// Twinkling 'holiday' lights that fade up and down in brightness.
// Colors are chosen from a palette; a few palettes are provided.
@kriegsman
kriegsman / SoftTwinkles.ino
Last active June 12, 2024 21:34
Soft, warm twinkles. Super short code, super complicated theory of operation.
#include "FastLED.h"
#define LED_PIN 3
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS 30
CRGB leds[NUM_LEDS];
#define BRIGHTNESS 120
#define DENSITY 80
@kriegsman
kriegsman / uqadd8x4.cpp
Last active August 29, 2015 14:10
C wrapper for ARM uqadd8
// See also __uqadd8
static inline uint8x4_t uqadd8x4 (uint8x4_t xs, uint8x4_t ys)
{
uint8x4_t sums;
asm volatile(
"uqadd8 %[sums], %[xs], %[ys]"
: [sums] "=r" (sums)
: [xs] "%r" (xs), [ys] "r" (ys));
return sums;
@kriegsman
kriegsman / BrianBasic.ino
Created November 25, 2014 13:52
Rainbow color wash demo sketch for Brian
#include <FastLED.h>
#define LED_PIN 3
#define LED_TYPE WS2811
#define COLOR_ORDER RGB
#define COLOR_CORRECTION CRGB(255,172,240)
#define BRIGHTNESS 64
#define NUM_LEDS 100