FastLED 3.9.3
|
Waveform generators that reset at a given number of "beats per minute" (BPM).
The standard "beat" functions generate "sawtooth" waves which rise from 0 up to a max value and then reset, continuously repeating that cycle at the specified frequency (BPM).
The "sin" versions function similarly, but create an oscillating sine wave at the specified frequency.
BPM can be supplied two ways. The simpler way of specifying BPM is as a simple 8-bit integer from 1-255, (e.g., "120"). The more sophisticated way of specifying BPM allows for fractional "Q8.8" fixed point number (an accum88) with an 8-bit integer part and an 8-bit fractional part. The easiest way to construct this is to multiply a floating point BPM value (e.g. 120.3) by 256, (e.g. resulting in 30796 in this case), and pass that as the 16-bit BPM argument.
Originally these functions were designed to make an entire animation project pulse. with brightness. For that effect, add this line just above your existing call to "FastLED.show()":
The entire animation will now pulse between brightness 192 and 255 once per second.
millis()
function, accuracy is a bit better than one part in a thousand. Functions | |
LIB8STATIC uint16_t | beat88 (accum88 beats_per_minute_88, uint32_t timebase=0) |
Generates a 16-bit "sawtooth" wave at a given BPM, with BPM specified in Q8.8 fixed-point format. | |
LIB8STATIC uint16_t | beat16 (accum88 beats_per_minute, uint32_t timebase=0) |
Generates a 16-bit "sawtooth" wave at a given BPM. | |
LIB8STATIC uint8_t | beat8 (accum88 beats_per_minute, uint32_t timebase=0) |
Generates an 8-bit "sawtooth" wave at a given BPM. | |
LIB8STATIC uint16_t | beatsin88 (accum88 beats_per_minute_88, uint16_t lowest=0, uint16_t highest=65535, uint32_t timebase=0, uint16_t phase_offset=0) |
Generates a 16-bit sine wave at a given BPM that oscillates within a given range. | |
LIB8STATIC uint16_t | beatsin16 (accum88 beats_per_minute, uint16_t lowest=0, uint16_t highest=65535, uint32_t timebase=0, uint16_t phase_offset=0) |
Generates a 16-bit sine wave at a given BPM that oscillates within a given range. | |
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 uint16_t beat16 | ( | accum88 | beats_per_minute, |
uint32_t | timebase = 0 ) |
Generates a 16-bit "sawtooth" wave at a given BPM.
beats_per_minute | the frequency of the wave, in decimal |
timebase | the time offset of the wave from the millis() timer |
Definition at line 918 of file lib8tion.h.
LIB8STATIC uint8_t beat8 | ( | accum88 | beats_per_minute, |
uint32_t | timebase = 0 ) |
Generates an 8-bit "sawtooth" wave at a given BPM.
beats_per_minute | the frequency of the wave, in decimal |
timebase | the time offset of the wave from the millis() timer |
Definition at line 928 of file lib8tion.h.
LIB8STATIC uint16_t beat88 | ( | accum88 | beats_per_minute_88, |
uint32_t | timebase = 0 ) |
Generates a 16-bit "sawtooth" wave at a given BPM, with BPM specified in Q8.8 fixed-point format.
beats_per_minute_88 | the frequency of the wave, in Q8.8 format |
timebase | the time offset of the wave from the millis() timer |
Definition at line 902 of file lib8tion.h.
LIB8STATIC uint16_t beatsin16 | ( | accum88 | beats_per_minute, |
uint16_t | lowest = 0, | ||
uint16_t | highest = 65535, | ||
uint32_t | timebase = 0, | ||
uint16_t | phase_offset = 0 ) |
Generates a 16-bit sine wave at a given BPM that oscillates within a given range.
beats_per_minute | the frequency of the wave, in decimal |
lowest | the lowest output value of the sine wave |
highest | the highest output value of the sine wave |
timebase | the time offset of the wave from the millis() timer |
phase_offset | phase offset of the wave from the current position |
Definition at line 962 of file lib8tion.h.
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.
beats_per_minute | the frequency of the wave, in decimal |
lowest | the lowest output value of the sine wave |
highest | the highest output value of the sine wave |
timebase | the time offset of the wave from the millis() timer |
phase_offset | phase offset of the wave from the current position |
Definition at line 980 of file lib8tion.h.
LIB8STATIC uint16_t beatsin88 | ( | accum88 | beats_per_minute_88, |
uint16_t | lowest = 0, | ||
uint16_t | highest = 65535, | ||
uint32_t | timebase = 0, | ||
uint16_t | phase_offset = 0 ) |
Generates a 16-bit sine wave at a given BPM that oscillates within a given range.
beats_per_minute_88 | the frequency of the wave, in Q8.8 format |
lowest | the lowest output value of the sine wave |
highest | the highest output value of the sine wave |
timebase | the time offset of the wave from the millis() timer |
phase_offset | phase offset of the wave from the current position |
Definition at line 944 of file lib8tion.h.