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

◆ pacifica_add_whitecaps()

void pacifica_add_whitecaps ( )
Examples
Pacifica.ino.

Definition at line 141 of file Pacifica.ino.

142{
143 uint8_t basethreshold = beatsin8( 9, 55, 65);
144 uint8_t wave = beat8( 7 );
145
146 for( uint16_t i = 0; i < NUM_LEDS; i++) {
147 uint8_t threshold = scale8( sin8( wave), 20) + basethreshold;
148 wave += 7;
149 uint8_t l = leds[i].getAverageLight();
150 if( l > threshold) {
151 uint8_t overage = l - threshold;
152 uint8_t overage2 = qadd8( overage, overage);
153 leds[i] += CRGB( overage, overage2, qadd8( overage2, overage2));
154 }
155 }
156}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
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:785
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:837
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
Definition math8.h:40
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:44
#define sin8
Platform-independent alias of the fast sin implementation.
Definition trig8.h:230
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86

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: