Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void final_1(String color, int duration)
- {
- // exponential backof
- int delay_ms = 50; // ms
- int exponential_delay = 500;
- float rate = 1.1;
- int min_delay = 20;
- unsigned long timer = millis();
- CRGB parsed_color = get_color(color);
- while (millis() - timer < duration)
- {
- for (int j = 0; j < NUM_LEDS; j++)
- {
- leds[j] = parsed_color;
- }
- FastLED.show();
- delay(exponential_delay);
- turn_off_leds();
- delay(exponential_delay);
- if (exponential_delay < min_delay)
- {
- exponential_delay = min_delay;
- } else {
- exponential_delay = exponential_delay / rate;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement