// List of patterns to cycle through. Each is defined as a separate function below.
typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = { off, flash, off, police };
uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
uint8_t gHue = 0; // rotating “base color” used by many of the patterns
int pulse_light = LEDS_NUM-1;
int leds_pos = 0;
int rc;
int rc_high = true;
// Call the current pattern function once, updating the ‘leds’ array
gPatternsgCurrentPatternNumber;
// pulse light in last LED of arms
pulse();
// send the ‘leds’ array out to the actual LED strip
FastLED.show();
// insert a delay to keep the framerate modest
// FastLED.delay(1000 / FRAMES_PER_SECOND);
// do some periodic updates
EVERY_N_MILLISECONDS( 20 ) {
gHue++; // slowly cycle the “base color” through the rainbow
}
EVERY_N_SECONDS( 10 ) {
// nextPattern(); // change patterns periodically
}
// RC control
if (rc > 1500 && !rc_high) {
rc_high = true;
nextPattern();
}
if (rc < 1500 && rc_high) {
rc_high = false;
}
void nextPattern()
{
// add one to the current pattern number, and wrap around at the end
gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}
void topEffect()
{
// a colored dot sweeping back and forth, with fading trails
fadeToBlackBy( leds_top, LONG_LEDS_NUM, 30);
int pos = beatsin16(40, 0, LONG_LEDS_NUM);
leds_top[pos] += CHSV( gHue, 255, 192);
}
void off()
{
for (int i = 0; i < LEDS_NUM; i++) {
leds_left[i] = CRGB::Black;
leds_right[i] = CRGB::Black;
leds_back[i] = CRGB::Black;
}
}