-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfetti.ino
43 lines (29 loc) · 853 Bytes
/
confetti.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "FastLED.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Confetti
//
//////////////////////////////////////////////////
#define NUM_LEDS 24
// Data pin that led data will be written out over
#define DATA_PIN 6
// Clock pin only needed for SPI based chipsets when not using hardware SPI
//#define CLOCK_PIN 8
CRGB leds[NUM_LEDS];
void setup() {
// sanity check delay - allows reprogramming if accidentally blowing power w/leds
delay(2000);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
// set master brightness to enable FastLED dithering
FastLED.setBrightness(96);
}
void loop() {
fadeToBlackBy( leds, NUM_LEDS, 33);
int x = random16(NUM_LEDS);
if (!leds[x])
{
leds[ x ] += CHSV( random8(), 255, 255);
}
FastLED.show();
FastLED.delay(60);
}