-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjugglep.h
28 lines (17 loc) · 1.4 KB
/
jugglep.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
#ifndef JUGGLEP_H
#define JUGGLEP_H
void jugglep() { // Use the juggle routine, but adjust the timebase based on sampleavg for some randomness.
// Persistent local variables
static uint8_t curhue; // Let's rotate the hue.
static int thistime = 20; // Time shifted value keeps changing thus interrupting the juggle pattern.
timeval = 20; // Our EVERY_N_MILLIS_I timer value.
curhue = curhue + 4; // Change the hue pretty quickly, so that the juggle changes colours on the fly.
fadeToBlackBy(leds, NUM_LEDS, 12); // Fade the strand.
leds[beatsin16(thistime,0,NUM_LEDS-1, 0, 0)] += ColorFromPalette( currentPalette, curhue, sampleavg, currentBlending);
leds[beatsin16(thistime-3,0,NUM_LEDS-1, 0, 0)] += ColorFromPalette( currentPalette, curhue, sampleavg, currentBlending);
EVERY_N_MILLISECONDS(250) {
thistime = sampleavg/2; // Change the beat frequency every 250 ms. By Andrew Tuline.
}
addGlitter(sampleavg/2); // Add glitter based on sampleavg.
}
#endif