Skip to content

Instantly share code, notes, and snippets.

@Palakis
Last active November 20, 2015 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Palakis/75f72802a969c55ce19e to your computer and use it in GitHub Desktop.
Save Palakis/75f72802a969c55ce19e to your computer and use it in GitHub Desktop.
#include <FastLED.h>
#define LED_PIN 6
#define NUM_LEDS 20
#define BRIGHTNESS 255
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 50
unsigned int brightCycles = 0;
void setup() {
delay( 3000 );
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness(BRIGHTNESS);
}
void loop()
{
if(brightCycles > 1) {
FastLED.setBrightness(0);
brightCycles = 0;
} else {
FastLED.setBrightness(BRIGHTNESS);
for(int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV(random(0, 255), 255, 255);
}
brightCycles++;
}
FastLED.show();
FastLED.delay(1000 / UPDATES_PER_SECOND);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment