Created
November 25, 2014 13:52
-
-
Save kriegsman/4198591b8d41b044fab7 to your computer and use it in GitHub Desktop.
Rainbow color wash demo sketch for Brian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
CRGB leds[NUM_LEDS]; | |
// setup gets called once | |
void setup() { | |
// power-up sanity delay | |
delay( 3000 ); | |
// tell FastLED about the LEDs | |
FastLED.addLeds<LED_TYPE,LED_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); | |
// set master brightness control | |
FastLED.setBrightness(BRIGHTNESS); | |
} | |
// loop is called repeatedly forever | |
void loop() | |
{ | |
// fill 'leds' array with a rainbow, starting at | |
// a slightly different color each time, to create motion. | |
static uint8_t startIndex = 0; | |
startIndex = startIndex + 1; /* higher = faster motion */ | |
fill_rainbow( leds, NUM_LEDS, startIndex); | |
// tell FastLED to send the 'leds' buffer out to the | |
// actual LEDs | |
FastLED.show(); | |
// insert a delay to keep the framerate modest (eg, 60 FPS). | |
// delay takes milliseconds, to 1000/60 = about 60 FPS. | |
FastLED.delay(1000 / 60); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment