Last active
November 20, 2015 12:16
-
-
Save Palakis/75f72802a969c55ce19e to your computer and use it in GitHub Desktop.
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 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