-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoPatterns.h
52 lines (42 loc) · 1.04 KB
/
DemoPatterns.h
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
43
44
45
46
47
48
49
50
51
52
#ifndef _DEMO_PATTERNS_H
#define _DEMO_PATTERNS_H
void rainbow() {
static uint8_t hue = 0;
fill_rainbow( leds, NUM_LEDS, hue++, 7);
FastLED.show();
delay(DELAY / 2);
}
void addGlitter( fract8 chanceOfGlitter) {
if( random8() < chanceOfGlitter) {
leds[ random16(NUM_LEDS) ] += CRGB::White;
}
}
void rainbowWithGlitter() {
static uint8_t hue = 0;
fill_rainbow( leds, NUM_LEDS, hue++, 7);
addGlitter(80);
FastLED.show();
delay(DELAY / 2);
}
void confetti() {
// random colored speckles that blink in and fade smoothly
static uint8_t hue = 0;
fadeToBlackBy( leds, NUM_LEDS, 10);
int pos = random16(NUM_LEDS);
leds[pos] += CHSV( hue, 200, 255);
hue += random8(64);
FastLED.show();
delay(DELAY / 2);
}
void juggle() {
// eight colored dots, weaving in and out of sync with each other
fadeToBlackBy( leds, NUM_LEDS, 20);
byte dothue = 0;
for( int i = 0; i < 8; i++) {
leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255);
dothue += 32;
}
FastLED.show();
delay(DELAY / 2);
}
#endif