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}
LIB8STATIC uint8_t beat8(accum88 beats_per_minute, uint32_t timebase=0)
Generates an 8-bit "sawtooth" wave at a given BPM.
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.
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
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 ...
#define sin8
Platform-independent alias of the fast sin implementation.
Representation of an RGB pixel (Red, Green, Blue)