FastLED 3.9.15
Loading...
Searching...
No Matches

◆ pacifica_add_whitecaps()

void pacifica_add_whitecaps ( )
Examples
Pacifica.ino.

Definition at line 131 of file Pacifica.ino.

132{
133 uint8_t basethreshold = beatsin8( 9, 55, 65);
134 uint8_t wave = beat8( 7 );
135
136 for( uint16_t i = 0; i < NUM_LEDS; i++) {
137 uint8_t threshold = scale8( sin8( wave), 20) + basethreshold;
138 wave += 7;
139 uint8_t l = leds[i].getAverageLight();
140 if( l > threshold) {
141 uint8_t overage = l - threshold;
142 uint8_t overage2 = qadd8( overage, overage);
143 leds[i] += CRGB( overage, overage2, qadd8( overage2, overage2));
144 }
145 }
146}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
LIB8STATIC uint8_t beat8(accum88 beats_per_minute, uint32_t timebase=0)
Generates an 8-bit "sawtooth" wave at a given BPM.
Definition lib8tion.h:923
LIB8STATIC uint8_t beatsin8(accum88 beats_per_minute, uint8_t lowest=0, uint8_t highest=255, uint32_t timebase=0, uint8_t phase_offset=0)
Generates an 8-bit sine wave at a given BPM that oscillates within a given range.
Definition lib8tion.h:975
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
Definition math8.h:31
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
Definition scale8.h:34
#define sin8
Platform-independent alias of the fast sin implementation.
Definition trig8.h:216
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54

References beat8(), beatsin8(), leds, NUM_LEDS, qadd8(), scale8(), and sin8.

Referenced by fl::Pacifica::draw(), and pacifica_loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: