Guest User

Untitled

a guest
Oct 20th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 50.64 KB | None | 0 0
  1. #include <Wire.h>
  2. #include "RTClib.h"
  3. #include <FastLED.h>
  4.  
  5. RTC_DS1307 rtc;
  6.  
  7. #define LED_TYPE    WS2811
  8. #define COLOR_ORDER BRG
  9. #define BRIGHTNESS          96
  10. #define FRAMES_PER_SECOND  120
  11.  
  12. #define DATA_PIN_L1    3
  13. #define DATA_PIN_L2    4
  14. #define DATA_PIN_L3    5
  15. #define DATA_PIN_L4    6
  16. #define DATA_PIN_R1    20
  17. #define DATA_PIN_R2    21
  18. #define DATA_PIN_R3    22
  19. #define DATA_PIN_R4    23
  20.  
  21. #define NUM_LEDS_L1   71
  22. #define NUM_LEDS_L2   82
  23. #define NUM_LEDS_L3   73
  24. #define NUM_LEDS_L4   62
  25. #define NUM_LEDS_R1   67
  26. #define NUM_LEDS_R2   76
  27. #define NUM_LEDS_R3   67
  28. #define NUM_LEDS_R4   97
  29.  
  30. //Color Cyclon variables
  31. #define MGPu CRGB(0x8010ff) // Mardi Gras Purple
  32. #define MGGr CRGB(0x2cb004) // Green
  33. #define MGGo CRGB(0xff4a00) // Gold
  34.  
  35. #define SECONDS_PER_PALETTE 600 // Variables for Palettes_changer
  36.  
  37. CRGB leds_L1[NUM_LEDS_L1];
  38. CRGB leds_L2[NUM_LEDS_L2];
  39. CRGB leds_L3[NUM_LEDS_L3];
  40. CRGB leds_L4[NUM_LEDS_L4];
  41. CRGB leds_R1[NUM_LEDS_R1];
  42. CRGB leds_R2[NUM_LEDS_R2];
  43. CRGB leds_R3[NUM_LEDS_R3];
  44. CRGB leds_R4[NUM_LEDS_R4];
  45.  
  46. // variables chases
  47. int16_t pos_chase_R1 = 0; //initial chase position by strips
  48. int16_t pos_chase_R2 = 0;
  49. int16_t pos_chase_R3 = 0;
  50. int16_t pos_chase_R4 = 0;
  51. int16_t pos_chase_L1 = 0;
  52. int16_t pos_chase_L2 = 0;
  53. int16_t pos_chase_L3 = 0;
  54. int16_t pos_chase_L4 = 0;
  55. int8_t deltaFoward = 1;
  56. int8_t deltaBackward = -1;
  57. uint16_t holdTimeFoward = 100; //ms
  58. uint16_t holdTimeBackward = 100; //ms
  59.  
  60. // variables fade in fade out
  61. uint8_t hue = 0;
  62. uint8_t sat = 255;
  63. uint8_t val = 0;
  64. boolean fadeDirection = 1;  // [1=fade up, 0=fade down]
  65.  
  66. // Array of predefined colors
  67. CRGB colorArray[] = {
  68.   CRGB::Red,
  69.   CRGB::Grey,
  70.   CRGB::Blue,
  71.   CRGB(0,255,0),
  72.   CHSV(195,255,255),
  73. };
  74.  
  75. uint8_t colorPick;
  76.  
  77. // Palette variables
  78. extern const TProgmemRGBGradientPalettePtr gGradientPalettes[];
  79. extern const uint8_t gGradientPaletteCount;
  80.  
  81. // Current palette number from the 'playlist' of color palettes
  82. uint8_t gCurrentPaletteNumber = 0;
  83.  
  84. CRGBPalette16 gCurrentPalette( CRGB::Black);
  85. CRGBPalette16 gTargetPalette( gGradientPalettes[0] );
  86.  
  87. //DateTime now = rtc.now();
  88.  
  89.  
  90.  
  91.  
  92.  //////////////////////////////////////////////// SETUP //////////////////////////////////////////////////////
  93.  
  94. void setup () {
  95.   delay(2000);
  96.   Serial.begin(57600);
  97.   Serial.println("Starting setup");//add this line for debug
  98.   Wire.begin();
  99.   rtc.begin();
  100.  
  101.  
  102.   rtc.adjust(DateTime(2020, 10, 15, 09, 36, 00));
  103.  
  104.  
  105.   FastLED.addLeds<LED_TYPE,DATA_PIN_L1,COLOR_ORDER>(leds_L1, NUM_LEDS_L1).setCorrection(TypicalLEDStrip);
  106.   FastLED.addLeds<LED_TYPE,DATA_PIN_L2,COLOR_ORDER>(leds_L2, NUM_LEDS_L2).setCorrection(TypicalLEDStrip);
  107.   FastLED.addLeds<LED_TYPE,DATA_PIN_L3,COLOR_ORDER>(leds_L3, NUM_LEDS_L3).setCorrection(TypicalLEDStrip);
  108.   FastLED.addLeds<LED_TYPE,DATA_PIN_L4,COLOR_ORDER>(leds_L4, NUM_LEDS_L4).setCorrection(TypicalLEDStrip);
  109.   FastLED.addLeds<LED_TYPE,DATA_PIN_R1,COLOR_ORDER>(leds_R1, NUM_LEDS_R1).setCorrection(TypicalLEDStrip);
  110.   FastLED.addLeds<LED_TYPE,DATA_PIN_R2,COLOR_ORDER>(leds_R2, NUM_LEDS_R2).setCorrection(TypicalLEDStrip);
  111.   FastLED.addLeds<LED_TYPE,DATA_PIN_R3,COLOR_ORDER>(leds_R3, NUM_LEDS_R3).setCorrection(TypicalLEDStrip);
  112.   FastLED.addLeds<LED_TYPE,DATA_PIN_R4,COLOR_ORDER>(leds_R4, NUM_LEDS_R4).setCorrection(TypicalLEDStrip);
  113. }
  114.  
  115.  
  116. //////////////////////////////////////////////// LOOP //////////////////////////////////////////////////////
  117.  
  118. void loop () {
  119.  
  120.  
  121.     DateTime now = rtc.now();
  122.      
  123.  
  124. // 00:00:00
  125.    if(now.hour() >= 0 && now.minute() <=30 && now.hour() < 1 ){
  126.     if (now.minute() >29 ) {
  127.       fadeBetween();
  128.     }
  129.     else {
  130.       palette_changer();
  131.     } }  
  132.  
  133. // 00:30:00
  134.    else if(now.hour() >= 0 && now.minute() >30 && now.hour() < 1){
  135.     if (now.minute() >59 ) {
  136.       fadeBetween();
  137.     }
  138.     else {
  139.       juggle(170);
  140.     } }
  141.  
  142.  
  143.    
  144. // 01:00:00
  145.    else if(now.hour() >= 1 && now.minute() <=30 && now.hour() < 2){
  146.     if (now.minute() >29 ) {
  147.       fadeBetween();
  148.     }
  149.     else {
  150.       palette_changer();
  151.       //confetti(40,60);
  152.     } }  
  153.  
  154.    
  155.  
  156. //01:30:00
  157.    else if(now.hour() >= 1 && now.minute() >30  && now.hour() < 2){
  158.      if (now.minute() >59 ) {
  159.       fadeBetween();
  160.     }
  161.     else {
  162.       palette_changer();
  163.     } }
  164.  
  165. //02:00:00
  166.    else if(now.hour() >= 2 && now.minute() <=30 && now.hour() < 3){
  167.     if (now.minute() >29  ) {
  168.       fadeBetween();
  169.     }
  170.     else {
  171.       sinelon_oneway(200, 130, 3);
  172.     } }
  173.  
  174. //02:30:00
  175.    else if(now.hour() >= 2 && now.minute() >30 && now.hour() < 3){
  176.     if (now.minute() >59 ) {
  177.       fadeBetween();
  178.     }
  179.     else {
  180.       chaseBackward(200,230);
  181.     } }  
  182.  
  183. //03:00:00
  184.    else if(now.hour() >= 3 && now.minute() <=30 && now.hour() < 4){
  185.     if (now.minute() >29 ) {
  186.       fadeBetween();
  187.     }
  188.     else {
  189.       juggle(0);
  190.     } }
  191.  
  192. //03:30:00
  193.    else if(now.hour() >= 3 && now.minute() >30 && now.hour() < 4){
  194.     if ( now.minute() >59 ) {
  195.       fadeBetween();
  196.     }
  197.     else {
  198.       palette_changer();
  199.     } }
  200.  
  201. //04:00:00
  202.    else if(now.hour() >= 4 && now.minute() <=30 && now.hour() < 5){
  203.     if ( now.minute()  >29  ) {
  204.       fadeBetween();
  205.     }
  206.     else {
  207.       chaseBackward(0,25);
  208.     } }
  209.  
  210. //04:30:00
  211.    else if(now.hour() >= 4 && now.minute() >30 && now.hour() < 5){
  212.     if ( now.minute()  >59 ) {
  213.       fadeBetween();
  214.     }
  215.     else {
  216.      fadeBetween();
  217.     } }  
  218.  
  219. //05:00:00
  220.    else if(now.hour() >= 5 && now.minute() <=30 && now.hour() < 6){
  221.     if (  now.minute()  >29  ) {
  222.       fadeBetween();
  223.     }
  224.     else {
  225.       sinelon_oneway(18, 50 , 2);
  226.     } }
  227.  
  228. //05:30:00
  229.    else if(now.hour() >= 5 && now.minute() >30 && now.hour() < 6){
  230.     if (now.minute()  >59  ) {
  231.       fadeBetween();
  232.     }
  233.     else {
  234.       confetti(160,180);
  235.     } }
  236.  
  237. //06:00:00
  238.    else if(now.hour() >= 6 && now.minute() <=30 && now.hour() < 7){
  239.     if (now.minute()  >29 ) {
  240.       fadeBetween();
  241.     }
  242.     else {
  243.       juggle(128);
  244.     } }
  245.  
  246. //06:30:00
  247.    else if(now.hour() >= 6 && now.minute() >30 && now.hour() < 7){
  248.     if (now.minute()  >59  ) {
  249.       fadeBetween();
  250.     }
  251.     else {
  252.       palette_changer();
  253.     } }
  254.  
  255. //07:00:00
  256.    else if(now.hour() >= 7 && now.minute() <=30 && now.hour() < 8){
  257.     if (now.minute()  >29  ) {
  258.       fadeBetween();
  259.     }
  260.     else {
  261.       confetti(200,225);
  262.     } }  
  263.  
  264. //07:30:00
  265.    else if(now.hour() >= 7 && now.minute() >30 && now.hour() < 8){
  266.     if (now.minute()  >59  ) {
  267.       fadeBetween();
  268.     }
  269.     else {
  270.       chaseBackward(128,158);
  271.     } }  
  272.  
  273. //08:00:00
  274.    else if(now.hour() >= 8 && now.minute() <30 && now.hour() < 9){
  275.     if (now.minute()  >29 ) {
  276.       fadeBetween();
  277.     }
  278.     else {
  279.       confetti(0,30);
  280.     } }
  281.  
  282. //08:30:00
  283.    else if(now.hour() >= 8 && now.minute() >30 && now.hour() < 9){
  284.     if (now.minute()  >59  ) {
  285.       fadeBetween();
  286.     }
  287.     else {
  288.       palette_changer();
  289.     } }  
  290.  
  291. //09:00:00
  292.    else if(now.hour() >= 9 && now.minute() <=30 && now.hour() < 10){
  293.     if ( now.minute()  >29  ) {
  294.       fadeBetween();
  295.     }
  296.     else {
  297.        confetti(0,180);
  298.     } }
  299.  
  300. //09:30:00
  301.    else if(now.hour() >= 9 && now.minute() >30 && now.hour() < 10){
  302.     if (now.minute()  >59 ) {
  303.       fadeBetween();
  304.     }
  305.     else {
  306.       palette_changer();
  307.     } }
  308.  
  309. //10:00:00
  310.    else if(now.hour() >= 10 && now.minute() <=30 && now.hour() < 11){
  311.     if (now.minute()  >29 ) {
  312.       fadeBetween();
  313.     }
  314.     else {
  315.       confetti(128,150);
  316.     } }
  317.  
  318. //10:30:00
  319.    else if(now.hour() >= 10 && now.minute() >30 && now.hour() < 11){
  320.     if (now.minute()  >59 ) {
  321.       fadeBetween();
  322.     }
  323.     else {
  324.       sinelon_oneway(80, 160, 3);
  325.     } }
  326.  
  327. //11:00:00
  328.    else if(now.hour() >= 11 && now.minute() <=30 && now.hour() < 12){
  329.     if (now.minute()  >29 ) {
  330.       fadeBetween();
  331.     }
  332.     else {
  333.       chaseBackward(200,230);
  334.     } }
  335.  
  336. //11:30:00
  337.    else if(now.hour() >= 11 && now.minute() >30 && now.hour() < 12){
  338.     if (now.minute()  >59 ) {
  339.       fadeBetween();
  340.     }
  341.     else {
  342.       confetti(128,134);
  343.     } }
  344.  
  345. //12:00:00
  346.    else if(now.hour() >= 12 && now.minute() <=30 && now.hour() < 13){
  347.     if (now.minute()  >29 ) {
  348.       fadeBetween();
  349.     }
  350.     else {
  351.       juggle(24);
  352.     } }
  353.  
  354. //12:30:00
  355.    else if(now.hour() >= 12 && now.minute() >30 && now.hour() < 13){
  356.     if ( now.minute()  >59 ) {
  357.       fadeBetween();
  358.     }
  359.     else {
  360.       palette_changer();
  361.     } }
  362.  
  363. //13:00:00
  364.    else if(now.hour() >= 13 && now.minute() <=30 && now.hour() < 14){
  365.     if (now.minute()  >29 ) {
  366.       fadeBetween();
  367.     }
  368.     else {
  369.       sinelon_oneway(40, 215, 3);
  370.     } }
  371.  
  372. //13:30:00
  373.    else if(now.hour() >= 13 && now.minute() >30 && now.hour() < 14){
  374.     if (now.minute()  >59 ) {
  375.       fadeBetween();
  376.     }
  377.     else {
  378.       sinelon(200);
  379.     } }
  380.    
  381. //14:00:00
  382.    else if(now.hour() >= 14 && now.minute() <=30 && now.hour() < 15){
  383.     if (now.minute()  >29 ) {
  384.       fadeBetween();
  385.     }
  386.     else {
  387.       confetti(100,125);
  388.     } }
  389.  
  390. //14:30:00
  391.    else if(now.hour() >= 14 && now.minute() >30 && now.hour() < 15){
  392.     if ( now.minute()  >59 ) {
  393.       fadeBetween();
  394.     }
  395.     else {
  396.       chaseBackward(111,134);
  397.     } }
  398.  
  399. //15:00:00
  400.    else if(now.hour() >= 15 && now.minute() <=30 && now.hour() < 16){
  401.     if ( now.minute()  >29 ) {
  402.       fadeBetween();
  403.     }
  404.     else {
  405.       chaseBackward(200,230);
  406.     } }
  407.  
  408. //15:30:00
  409.    else if(now.hour() >= 15 && now.minute() >30 && now.hour() < 16){
  410.     if ( now.minute()  >59 ) {
  411.       fadeBetween();
  412.     }
  413.     else {
  414.       palette_changer();
  415.     } }
  416.  
  417. //16:00:00
  418.    else if(now.hour() >= 16 && now.minute() <=30 && now.hour() < 17){
  419.     if (  now.minute()  >29 ) {
  420.       fadeBetween();
  421.     }
  422.     else {
  423.       sinelon_oneway(100, 24, 3);
  424.     } }
  425.  
  426. //16:30:00
  427.    else if(now.hour() >= 16 && now.minute() >30 && now.hour() < 17){
  428.     if ( now.minute()  >59 ) {
  429.       fadeBetween();
  430.     }
  431.     else {
  432.       palette_changer();
  433.     } }
  434.  
  435. //17:00:00
  436.    else if(now.hour() >= 17 && now.minute() <=30 && now.hour() < 18){
  437.     if (now.minute()  >29 ) {
  438.       fadeBetween();
  439.     }
  440.     else {
  441.       chaseBackward(114,148);
  442.     } }
  443.  
  444. //17:30:00
  445.    else if(now.hour() >= 17 && now.minute() >30 && now.hour() < 18){
  446.     if ( now.minute()  >59 ) {
  447.       fadeBetween();
  448.     }
  449.     else {
  450.       fadeBetween();
  451.     } }
  452.  
  453. //18:00:00
  454.    else if(now.hour() >= 18 && now.minute() <=30 && now.hour() < 19){
  455.     if (now.minute()  >29 ) {
  456.       fadeBetween();
  457.     }
  458.     else {
  459.       confetti(24,48);
  460.     } }
  461.  
  462. //18:30:00
  463.    else if(now.hour() >= 18 && now.minute() >30 && now.hour() < 19){
  464.     if ( now.minute()  >59 ) {
  465.       fadeBetween();
  466.     }
  467.     else {
  468.       juggle(0);
  469.     } }
  470.  
  471. //19:00:00
  472.    else if(now.hour() >= 19 && now.minute() <=30 && now.hour() < 20){
  473.     if ( now.minute()  >29 ) {
  474.       fadeBetween();
  475.     }
  476.     else {
  477.       palette_changer();
  478.     } }
  479.  
  480. //19:30:00
  481.    else if(now.hour() >= 19 && now.minute() >30 && now.hour() < 20){
  482.     if ( now.minute()  >59 ) {
  483.       fadeBetween();
  484.     }
  485.     else {
  486.       confetti(30,56);
  487.     } }
  488.  
  489. //20:00:00
  490.    else if(now.hour() >= 20 && now.minute() <=30 && now.hour() < 21){
  491.     if ( now.minute()  >29 ) {
  492.       fadeBetween();
  493.     }
  494.     else {
  495.       chaseBackward(0,32);
  496.     } }
  497.  
  498. //20:30:00
  499.    else if(now.hour() >= 20 && now.minute() >30 && now.hour() < 21){
  500.     if ( now.minute()  >59 ) {
  501.       fadeBetween();
  502.     }
  503.     else {
  504.       sinelon_oneway(180, 24, 3);
  505.     } }
  506.  
  507. //21:00:00
  508.    else if(now.hour() >= 21 && now.minute() <=30 && now.hour() < 22){
  509.     if ( now.minute()  >29 ) {
  510.       fadeBetween();
  511.     }
  512.     else {
  513.      fadeBetween();
  514.     } }
  515.  
  516. //21:30:00
  517.    else if(now.hour() >= 21 && now.minute() >30 && now.hour() < 22){
  518.     if ( now.minute()  >59 ) {
  519.       fadeBetween();
  520.     }
  521.     else {
  522.       confetti(111,134);
  523.     } }
  524.  
  525. //22:00:00
  526.    else if(now.hour() >= 22 && now.minute() <=30 && now.hour() < 23){
  527.     if ( now.minute()  >29 ) {
  528.       fadeBetween();
  529.     }
  530.     else {
  531.       juggle(234);
  532.     } }
  533.  
  534. //22:30:00
  535.    else if(now.hour() >= 22 && now.minute() >30 && now.hour() < 23){
  536.     if ( now.minute()  >59 ) {
  537.       fadeBetween();
  538.     }
  539.     else {
  540.       palette_changer();
  541.     } }
  542.  
  543. //23:00:00
  544.    else if(now.hour() >= 23 && now.minute() <=30 && now.hour() < 24){
  545.     if ( now.minute()  >29 ) {
  546.       fadeBetween();
  547.     }
  548.     else {
  549.       chaseBackward(200,230);
  550.     } }
  551.  
  552. //23:30:00
  553.    else if(now.hour() >= 23 && now.minute() >30 && now.hour() < 24){
  554.     if ( now.minute()  >59 ) {
  555.       fadeBetween();
  556.     }
  557.     else {
  558.       sinelon_oneway(20, 24, 3);
  559.     } }
  560.    
  561.    else {
  562.  
  563.    
  564.    fillSolid(CRGB::Cyan); /////   <----------------- Change here
  565.    }
  566.  
  567.    
  568.     Serial.print(now.year(), DEC);
  569.     Serial.print('/');
  570.     Serial.print(now.month(), DEC);
  571.     Serial.print('/');
  572.     Serial.print(now.day(), DEC);
  573.     Serial.print(' ');
  574.     Serial.print(now.hour(), DEC);
  575.     Serial.print(':');
  576.     Serial.print(now.minute(), DEC);
  577.     Serial.print(':');
  578.     Serial.print(now.second(), DEC);
  579.     Serial.println();
  580.    
  581.     Serial.println();
  582.     //delay(3000);
  583.    
  584. }
  585.  
  586. //////////////////////////////////// FILL ALL ////////////////////////////////////
  587.  
  588. void fillSolid (CRGB solidColor) {
  589. // Variable CRGB donc : CRGB::White ou CRGB::Blue
  590.  
  591.   fill_solid( leds_R1, NUM_LEDS_R1, solidColor);
  592.   fill_solid( leds_R2, NUM_LEDS_R2, solidColor);
  593.   fill_solid( leds_R3, NUM_LEDS_R3, solidColor);
  594.   fill_solid( leds_R4, NUM_LEDS_R4, solidColor);
  595.  
  596.   fill_solid( leds_L1, NUM_LEDS_L1, solidColor);
  597.   fill_solid( leds_L2, NUM_LEDS_L2, solidColor);
  598.   fill_solid( leds_L3, NUM_LEDS_L3, solidColor);
  599.   fill_solid( leds_L4, NUM_LEDS_L4, solidColor);
  600.  
  601.   FastLED.show();
  602. }
  603.  
  604. void fadeBetween () {
  605.    if (fadeDirection == 1) {  //fade up
  606.     EVERY_N_MILLISECONDS(1){
  607.       fill_solid( leds_R1, NUM_LEDS_R1, CHSV(24,50,val) );
  608.       fill_solid( leds_R2, NUM_LEDS_R2, CHSV(24,50,val) );
  609.       fill_solid( leds_R3, NUM_LEDS_R3, CHSV(24,50,val) );
  610.       fill_solid( leds_R4, NUM_LEDS_R4, CHSV(24,50,val) );
  611.  
  612.       fill_solid( leds_L1, NUM_LEDS_L1, CHSV(24,50,val) );
  613.       fill_solid( leds_L2, NUM_LEDS_L2, CHSV(24,50,val) );
  614.       fill_solid( leds_L3, NUM_LEDS_L3, CHSV(24,50,val) );
  615.       fill_solid( leds_L4, NUM_LEDS_L4, CHSV(24,50,val) );
  616.       val = val + 3;
  617.       if (val == 225) {
  618.         fadeDirection = !fadeDirection;  //reverse direction
  619.       }
  620.     }
  621.   }
  622.  
  623.   if (fadeDirection == 0) {  //fade down
  624.     EVERY_N_MILLISECONDS(1){
  625.       fill_solid( leds_R1, NUM_LEDS_R1, CHSV(24,255,val) );
  626.       fill_solid( leds_R2, NUM_LEDS_R2, CHSV(24,255,val) );
  627.       fill_solid( leds_R3, NUM_LEDS_R3, CHSV(24,255,val) );
  628.       fill_solid( leds_R4, NUM_LEDS_R4, CHSV(24,255,val) );
  629.  
  630.       fill_solid( leds_L1, NUM_LEDS_L1, CHSV(24,255,val) );
  631.       fill_solid( leds_L2, NUM_LEDS_L2, CHSV(24,255,val) );
  632.       fill_solid( leds_L3, NUM_LEDS_L3, CHSV(24,255,val) );
  633.       fill_solid( leds_L4, NUM_LEDS_L4, CHSV(24,255,val) );
  634.       val = val - 3;
  635.       if (val == 0) {
  636.         fadeDirection = !fadeDirection;  //reverse direction
  637.       }
  638.     }
  639.   }
  640.  
  641.   FastLED.show();
  642.  
  643. }
  644.  
  645. //////////////////////////////////// HEAD FOOT HANDS ////////////////////////////////////
  646.  
  647. void light_Head_Foot_Hands(int color) {
  648. // Ajuster la couleur avec une variable de 0 a 255 CHSV
  649.  
  650.  
  651.    if (fadeDirection == 1) {  //fade up
  652.     EVERY_N_MILLISECONDS(20){
  653.       for(int dot = 29; dot < 44; dot++) { leds_R1[dot] = CHSV(color,sat,val);}
  654.       for(int dot = 49; dot < 70; dot++) { leds_R2[dot] = CHSV(color,sat,val);}
  655.       for(int dot = 18; dot < 26; dot++) { leds_R2[dot] = CHSV(color,sat,val);}
  656.       for(int dot = 25; dot < 32; dot++) { leds_R3[dot] = CHSV(color,sat,val);}
  657.       for(int dot = 50; dot < 63; dot++) { leds_R4[dot] = CHSV(color,sat,val);}
  658.      
  659.  
  660.       for(int dot = 45; dot < 55; dot++) { leds_L4[dot] = CHSV(color,sat,val);}
  661.       for(int dot = 29; dot < 47; dot++) { leds_L3[dot] = CHSV(color,sat,val);}
  662.       for(int dot = 48; dot < 58; dot++) { leds_L2[dot] = CHSV(color,sat,val);}
  663.       for(int dot = 33; dot < 43; dot++) { leds_L1[dot] = CHSV(color,sat,val);}
  664.       val = val + 1;
  665.       if (val == 255) {
  666.         fadeDirection = !fadeDirection;  //reverse direction
  667.       }
  668.     }
  669.   }
  670.  
  671.   if (fadeDirection == 0) {  //fade down
  672.     EVERY_N_MILLISECONDS(20){
  673.       for(int dot = 29; dot < 39; dot++) { leds_R1[dot] = CHSV(color,sat,val);}
  674.       for(int dot = 49; dot < 63; dot++) { leds_R2[dot] = CHSV(color,sat,val);}
  675.       for(int dot = 18; dot < 24; dot++) { leds_R2[dot] = CHSV(color,sat,val);}
  676.       for(int dot = 25; dot < 30; dot++) { leds_R3[dot] = CHSV(color,sat,val);}
  677.       for(int dot = 51; dot < 61; dot++) { leds_R4[dot] = CHSV(color,sat,val);}
  678.  
  679.       for(int dot = 45; dot < 55; dot++) { leds_L4[dot] = CHSV(color,sat,val);}
  680.       for(int dot = 29; dot < 47; dot++) { leds_L3[dot] = CHSV(color,sat,val);}
  681.       for(int dot = 48; dot < 56; dot++) { leds_L2[dot] = CHSV(color,sat,val);}
  682.       for(int dot = 29; dot < 36; dot++) { leds_L1[dot] = CHSV(color,sat,val);}
  683.       val = val - 1;
  684.       if (val == 20) {
  685.         fadeDirection = !fadeDirection;  //reverse direction
  686.       }
  687.     }
  688.   }
  689.    FastLED.show();
  690. }
  691.  
  692. ////////////////////////////////////  CHASE BACKWARD ////////////////////////////////////
  693.  
  694. void chaseBackward (int color1, int color2) {
  695. // Ajuster les 2 couleurs avec des CHSV de 0 à 255
  696.  
  697. /// With pulse animation
  698.     if (fadeDirection == 1) {  //fade up
  699.     EVERY_N_MILLISECONDS(20){
  700.       fill_solid( leds_R1, NUM_LEDS_R1, CHSV(color2,sat,val) );
  701.       fill_solid( leds_R2, NUM_LEDS_R2, CHSV(color1,sat,val) );
  702.       fill_solid( leds_R3, NUM_LEDS_R3, CHSV(color2,sat,val) );
  703.       fill_solid( leds_R4, NUM_LEDS_R4, CHSV(color1,sat,val) );
  704.  
  705.       fill_solid( leds_L1, NUM_LEDS_L1, CHSV(color2,sat,val) );
  706.       fill_solid( leds_L2, NUM_LEDS_L2, CHSV(color1,sat,val) );
  707.       fill_solid( leds_L3, NUM_LEDS_L3, CHSV(color2,sat,val) );
  708.       fill_solid( leds_L4, NUM_LEDS_L4, CHSV(color1,sat,val) );
  709.       val = val + 1;
  710.       if (val == 255) {
  711.         fadeDirection = !fadeDirection;  //reverse direction
  712.       }
  713.     }
  714.   }
  715.  
  716.   if (fadeDirection == 0) {  //fade down
  717.     EVERY_N_MILLISECONDS(20){
  718.       fill_solid( leds_R1, NUM_LEDS_R1, CHSV(color2,sat,val) );
  719.       fill_solid( leds_R2, NUM_LEDS_R2, CHSV(color1,sat,val) );
  720.       fill_solid( leds_R3, NUM_LEDS_R3, CHSV(color2,sat,val) );
  721.       fill_solid( leds_R4, NUM_LEDS_R4, CHSV(color1,sat,val) );
  722.  
  723.       fill_solid( leds_L1, NUM_LEDS_L1, CHSV(color2,sat,val) );
  724.       fill_solid( leds_L2, NUM_LEDS_L2, CHSV(color1,sat,val) );
  725.       fill_solid( leds_L3, NUM_LEDS_L3, CHSV(color2,sat,val) );
  726.       fill_solid( leds_L4, NUM_LEDS_L4, CHSV(color1,sat,val) );
  727.       val = val - 1;
  728.       if (val == 20) {
  729.         fadeDirection = !fadeDirection;  //reverse direction
  730.       }
  731.     }
  732.   }
  733.  
  734.   /// Chase animation
  735.  
  736.    EVERY_N_MILLISECONDS(holdTimeBackward) {
  737.  
  738.     leds_R1[pos_chase_R1] = CRGB::White;
  739.     leds_R2[pos_chase_R2] = CRGB::White;
  740.     leds_R3[pos_chase_R3] = CRGB::White;
  741.     leds_R4[pos_chase_R4] = CRGB::White;
  742.  
  743.     leds_L1[pos_chase_L1] = CRGB::White;
  744.     leds_L2[pos_chase_L2] = CRGB::White;
  745.     leds_L3[pos_chase_L3] = CRGB::White;
  746.     leds_L4[pos_chase_L4] = CRGB::White;
  747.    
  748.     FastLED.show();
  749.  
  750.     leds_R1[pos_chase_R1] = CRGB::Black;
  751.     leds_R2[pos_chase_R2] = CRGB::Black;
  752.     leds_R3[pos_chase_R3] = CRGB::Black;
  753.     leds_R4[pos_chase_R4] = CRGB::Black;
  754.  
  755.     leds_L1[pos_chase_L1] = CRGB::Black;
  756.     leds_L2[pos_chase_L2] = CRGB::Black;
  757.     leds_L3[pos_chase_L3] = CRGB::Black;
  758.     leds_L4[pos_chase_L4] = CRGB::Black;
  759.  
  760.     pos_chase_R1 = (pos_chase_R1 + deltaBackward + NUM_LEDS_R1) % NUM_LEDS_R1;
  761.     pos_chase_R2 = (pos_chase_R2 + deltaBackward + NUM_LEDS_R2) % NUM_LEDS_R2;
  762.     pos_chase_R3 = (pos_chase_R3 + deltaBackward + NUM_LEDS_R3) % NUM_LEDS_R3;
  763.     pos_chase_R4 = (pos_chase_R4 + deltaBackward + NUM_LEDS_R4) % NUM_LEDS_R4;
  764.  
  765.     pos_chase_L1 = (pos_chase_L1 + deltaBackward + NUM_LEDS_L1) % NUM_LEDS_L1;
  766.     pos_chase_L2 = (pos_chase_L2 + deltaBackward + NUM_LEDS_L2) % NUM_LEDS_L2;
  767.     pos_chase_L3 = (pos_chase_L3 + deltaBackward + NUM_LEDS_L3) % NUM_LEDS_L3;
  768.     pos_chase_L4 = (pos_chase_L4 + deltaBackward + NUM_LEDS_L4) % NUM_LEDS_L4;
  769.   }
  770.  
  771. }
  772.  
  773. void chaseonly (int color, int timechange) {
  774.    EVERY_N_MILLISECONDS(timechange) {
  775.  
  776.     leds_R1[pos_chase_R1] = CHSV(color,255,255);
  777.     leds_R2[pos_chase_R2] = CHSV(color,255,255);
  778.     leds_R3[pos_chase_R3] = CHSV(color,255,255);
  779.     leds_R4[pos_chase_R4] = CHSV(color,255,255);
  780.  
  781.     leds_L1[pos_chase_L1] = CHSV(color,255,255);
  782.     leds_L2[pos_chase_L2] = CHSV(color,255,255);
  783.     leds_L3[pos_chase_L3] = CHSV(color,255,255);
  784.     leds_L4[pos_chase_L4] = CHSV(color,255,255);
  785.    
  786.     FastLED.show();
  787.  
  788.     leds_R1[pos_chase_R1] = CRGB::Black;
  789.     leds_R2[pos_chase_R2] = CRGB::Black;
  790.     leds_R3[pos_chase_R3] = CRGB::Black;
  791.     leds_R4[pos_chase_R4] = CRGB::Black;
  792.  
  793.     leds_L1[pos_chase_L1] = CRGB::Black;
  794.     leds_L2[pos_chase_L2] = CRGB::Black;
  795.     leds_L3[pos_chase_L3] = CRGB::Black;
  796.     leds_L4[pos_chase_L4] = CRGB::Black;
  797.  
  798.     pos_chase_R1 = (pos_chase_R1 + deltaBackward + NUM_LEDS_R1) % NUM_LEDS_R1;
  799.     pos_chase_R2 = (pos_chase_R2 + deltaBackward + NUM_LEDS_R2) % NUM_LEDS_R2;
  800.     pos_chase_R3 = (pos_chase_R3 + deltaBackward + NUM_LEDS_R3) % NUM_LEDS_R3;
  801.     pos_chase_R4 = (pos_chase_R4 + deltaBackward + NUM_LEDS_R4) % NUM_LEDS_R4;
  802.  
  803.     pos_chase_L1 = (pos_chase_L1 + deltaBackward + NUM_LEDS_L1) % NUM_LEDS_L1;
  804.     pos_chase_L2 = (pos_chase_L2 + deltaBackward + NUM_LEDS_L2) % NUM_LEDS_L2;
  805.     pos_chase_L3 = (pos_chase_L3 + deltaBackward + NUM_LEDS_L3) % NUM_LEDS_L3;
  806.     pos_chase_L4 = (pos_chase_L4 + deltaBackward + NUM_LEDS_L4) % NUM_LEDS_L4;
  807.   }
  808. }
  809. //////////////////////////////////// FADE IN FADE OUT ////////////////////////////////////
  810.  
  811. void fadeIn_fadeOut (int color) {
  812. // Ajuster la couleur avec une variable de 0 à 255
  813.  
  814.   if (fadeDirection == 1) {  //fade up
  815.     EVERY_N_MILLISECONDS(20){
  816.       fill_solid( leds_R1, NUM_LEDS_R1, CHSV(color,sat,val) );
  817.       fill_solid( leds_R2, NUM_LEDS_R2, CHSV(color,sat,val) );
  818.       fill_solid( leds_R3, NUM_LEDS_R3, CHSV(color,sat,val) );
  819.       fill_solid( leds_R4, NUM_LEDS_R4, CHSV(color,sat,val) );
  820.  
  821.       fill_solid( leds_L1, NUM_LEDS_L1, CHSV(color,sat,val) );
  822.       fill_solid( leds_L2, NUM_LEDS_L2, CHSV(color,sat,val) );
  823.       fill_solid( leds_L3, NUM_LEDS_L3, CHSV(color,sat,val) );
  824.       fill_solid( leds_L4, NUM_LEDS_L4, CHSV(color,sat,val) );
  825.       val = val + 1;
  826.       if (val == 255) {
  827.         fadeDirection = !fadeDirection;  //reverse direction
  828.       }
  829.     }
  830.   }
  831.  
  832.   if (fadeDirection == 0) {  //fade down
  833.     EVERY_N_MILLISECONDS(20){
  834.       fill_solid( leds_R1, NUM_LEDS_R1, CHSV(color,sat,val) );
  835.       fill_solid( leds_R2, NUM_LEDS_R2, CHSV(color,sat,val) );
  836.       fill_solid( leds_R3, NUM_LEDS_R3, CHSV(color,sat,val) );
  837.       fill_solid( leds_R4, NUM_LEDS_R4, CHSV(color,sat,val) );
  838.  
  839.       fill_solid( leds_L1, NUM_LEDS_L1, CHSV(color,sat,val) );
  840.       fill_solid( leds_L2, NUM_LEDS_L2, CHSV(color,sat,val) );
  841.       fill_solid( leds_L3, NUM_LEDS_L3, CHSV(color,sat,val) );
  842.       fill_solid( leds_L4, NUM_LEDS_L4, CHSV(color,sat,val) );
  843.       val = val - 1;
  844.       if (val == 20) {
  845.         fadeDirection = !fadeDirection;  //reverse direction
  846.       }
  847.     }
  848.   }
  849.  
  850.   FastLED.show();
  851. }
  852.  
  853. //////////////////////////////////// CYCLON COLOR ////////////////////////////////////
  854.  
  855. void cyclonColor() {
  856.  
  857.   ///Not working find why
  858.  
  859.   cylon(MGPu);  // Purple.  (Call cylon function with this color.)
  860.   cylon(MGGr);  // Green
  861.   cylon(MGGo);  // Gold
  862. }
  863.  
  864. //////////////////////////////////// FADE ALL ////////////////////////////////////
  865.  
  866. void fadeall()  {  
  867.   for (int i = 0; i < NUM_LEDS_R1; i++) {leds_R1[i].nscale8(250);}
  868.   for (int i = 0; i < NUM_LEDS_R2; i++) {leds_R2[i].nscale8(250);}
  869.   for (int i = 0; i < NUM_LEDS_R3; i++) {leds_R3[i].nscale8(250);}
  870.   for (int i = 0; i < NUM_LEDS_R4; i++) {leds_R4[i].nscale8(250);}
  871.  
  872.   for (int i = 0; i < NUM_LEDS_L1; i++) {leds_L1[i].nscale8(250);}
  873.   for (int i = 0; i < NUM_LEDS_L2; i++) {leds_L2[i].nscale8(250);}
  874.   for (int i = 0; i < NUM_LEDS_L3; i++) {leds_L3[i].nscale8(250);}
  875.   for (int i = 0; i < NUM_LEDS_L4; i++) {leds_L4[i].nscale8(250);}
  876. }
  877.  
  878.  
  879. void cylon(CRGB streakcolor) {
  880.  
  881.  
  882.  
  883.   for (int i = 0; i < NUM_LEDS_R4; i++) {
  884.     leds_R1[i] = streakcolor;
  885.     leds_R2[i] = streakcolor;
  886.     leds_R3[i] = streakcolor;
  887.     leds_R4[i] = streakcolor;
  888.  
  889.     leds_L1[i] = streakcolor;
  890.     leds_L2[i] = streakcolor;
  891.     leds_L3[i] = streakcolor;
  892.     leds_L4[i] = streakcolor;
  893.    
  894.     FastLED.show();
  895.     fadeall();
  896.     FastLED.delay(50);
  897.   }
  898.  
  899.   for (int i = (NUM_LEDS_R4) - 1; i >= 0; i--) {
  900.     leds_R1[i] = streakcolor;
  901.     leds_R2[i] = streakcolor;
  902.     leds_R3[i] = streakcolor;
  903.     leds_R4[i] = streakcolor;
  904.  
  905.     leds_L1[i] = streakcolor;
  906.     leds_L2[i] = streakcolor;
  907.     leds_L3[i] = streakcolor;
  908.     leds_L4[i] = streakcolor;
  909.     FastLED.show();
  910.     fadeall();
  911.  
  912.     FastLED.delay(50);
  913.  
  914.    
  915.   }
  916. }
  917.  
  918. //////////////////////////////////// CONFETTI ////////////////////////////////////
  919. void confetti(int color1, int color2)
  920. // Ajuster les couleurs : color1 est le point de départ de la couleur sur le CHSV et color2 est le point d'arriver
  921. //tout ce qui se trouve entre les 2 peut être affiché comme couleur
  922. {
  923.  
  924.   // Ajouter variables pour changer les couleurs random du CHSV a chaque fois que le fonction est caller
  925.  
  926.   // random colored speckles that blink in and fade smoothly
  927.   fadeToBlackBy( leds_R1, NUM_LEDS_R1, 10);
  928.   fadeToBlackBy( leds_R2, NUM_LEDS_R2, 10);
  929.   fadeToBlackBy( leds_R3, NUM_LEDS_R3, 10);
  930.   fadeToBlackBy( leds_R4, NUM_LEDS_R4, 10);
  931.   fadeToBlackBy( leds_L1, NUM_LEDS_L1, 10);
  932.   fadeToBlackBy( leds_L2, NUM_LEDS_L2, 10);
  933.   fadeToBlackBy( leds_L3, NUM_LEDS_L3, 10);
  934.   fadeToBlackBy( leds_L4, NUM_LEDS_L4, 10);
  935.  
  936.   int posR1 = random16(NUM_LEDS_R1);
  937.   int posR2 = random16(NUM_LEDS_R2);
  938.   int posR3 = random16(NUM_LEDS_R3);
  939.   int posR4 = random16(NUM_LEDS_R4);
  940.   int posL1 = random16(NUM_LEDS_L1);
  941.   int posL2 = random16(NUM_LEDS_L2);
  942.   int posL3 = random16(NUM_LEDS_L3);
  943.   int posL4 = random16(NUM_LEDS_L4);
  944.   int ran1b = random(30,255);
  945.   int ran2b = random(30,255);
  946.   int ran3b = random(30,255);
  947.   int ran4b = random(30,255);
  948.   int ran5b = random(30,255);
  949.   int ran6b = random(30,255);
  950.   int ran7b = random(30,255);
  951.   int ran8b = random(30,255);
  952.  
  953.   int ran1c = random(color1,color2);
  954.   int ran2c = random(color1,color2);
  955.   int ran3c = random(color1,color2);
  956.   int ran4c = random(color1,color2);
  957.   int ran5c = random(color1,color2);
  958.   int ran6c = random(color1,color2);
  959.   int ran7c = random(color1,color2);
  960.   int ran8c = random(color1,color2);
  961.  
  962.   //Add random brightness to every confetti
  963.  
  964.   leds_R1[posR1] += CHSV( ran1c, 200, ran1b);
  965.   leds_R2[posR2] += CHSV( ran2c, 200, ran2b);
  966.   leds_R3[posR3] += CHSV( ran3c, 200, ran3b);
  967.   leds_R4[posR4] += CHSV( ran4c, 200, ran4b);
  968.   leds_L1[posL1] += CHSV( ran5c, 200, ran5b);
  969.   leds_L2[posL2] += CHSV( ran6c, 200, ran6b);
  970.   leds_L3[posL3] += CHSV( ran7c, 200, ran7b);
  971.   leds_L4[posL4] += CHSV( ran8c, 200, ran8b);
  972.  
  973.  
  974.   FastLED.show();
  975. }
  976.  
  977. //////////////////////////////////// SINELON ////////////////////////////////////
  978.  
  979. void sinelon(int color)
  980. {
  981.  
  982.   int speedSin = 3;
  983.  
  984.   fadeToBlackBy( leds_R1, NUM_LEDS_R1, 20);
  985.   fadeToBlackBy( leds_R2, NUM_LEDS_R2, 20);
  986.   fadeToBlackBy( leds_R3, NUM_LEDS_R3, 20);
  987.   fadeToBlackBy( leds_R4, NUM_LEDS_R4, 20);
  988.   fadeToBlackBy( leds_L1, NUM_LEDS_L1, 20);
  989.   fadeToBlackBy( leds_L2, NUM_LEDS_L2, 20);
  990.   fadeToBlackBy( leds_L3, NUM_LEDS_L3, 20);
  991.   fadeToBlackBy( leds_L4, NUM_LEDS_L4, 20);
  992.  
  993.   int posR1 = beatsin16( speedSin, 0, NUM_LEDS_R1-1 );
  994.   int posR2 = beatsin16( speedSin, 0, NUM_LEDS_R2-1 );
  995.   int posR3 = beatsin16( speedSin, 0, NUM_LEDS_R3-1 );
  996.   int posR4 = beatsin16( speedSin, 0, NUM_LEDS_R4-1 );
  997.   int posL1 = beatsin16( speedSin, 0, NUM_LEDS_L1-1 );
  998.   int posL2 = beatsin16( speedSin, 0, NUM_LEDS_L2-1 );
  999.   int posL3 = beatsin16( speedSin, 0, NUM_LEDS_L3-1 );
  1000.   int posL4 = beatsin16( speedSin, 0, NUM_LEDS_L4-1 );
  1001.  
  1002.   leds_R1[posR1] += CHSV( color, 255, 192);
  1003.   leds_R2[posR2] += CHSV( color, 255, 192);
  1004.   leds_R3[posR3] += CHSV( color, 255, 192);
  1005.   leds_R4[posR4] += CHSV( color, 255, 192);
  1006.  
  1007.   leds_L1[posL1] += CHSV( color, 255, 192);
  1008.   leds_L2[posL2] += CHSV( color, 255, 192);
  1009.   leds_L3[posL3] += CHSV( color, 255, 192);
  1010.   leds_L4[posL4] += CHSV( color, 255, 192);
  1011.  
  1012.   FastLED.show();
  1013. }
  1014.  
  1015. void sinelon_oneway(uint8_t BPM, int color, uint8_t fadeby)
  1016. {
  1017.   // a colored dot going in one direction with fading tail
  1018.   fadeToBlackBy( leds_R1, NUM_LEDS_R1, fadeby);
  1019.   fadeToBlackBy( leds_R2, NUM_LEDS_R2, fadeby);
  1020.   fadeToBlackBy( leds_R3, NUM_LEDS_R3, fadeby);
  1021.   fadeToBlackBy( leds_R4, NUM_LEDS_R4, fadeby);
  1022.   fadeToBlackBy( leds_L1, NUM_LEDS_L1, fadeby);
  1023.   fadeToBlackBy( leds_L2, NUM_LEDS_L2, fadeby);
  1024.   fadeToBlackBy( leds_L3, NUM_LEDS_L3, fadeby);
  1025.   fadeToBlackBy( leds_L4, NUM_LEDS_L4, fadeby);  //change fadeby to smaller or larger number to adjust the length of the tail.
  1026.  
  1027.   uint8_t u= beat8(BPM,0); //BPM will allow you to adjust the speed the dot is moving.
  1028.  
  1029.   uint16_t posR1=map(u,0,255,0,NUM_LEDS_R1);
  1030.   uint16_t posR2=map(u,0,255,0,NUM_LEDS_R2);
  1031.   uint16_t posR3=map(u,0,255,0,NUM_LEDS_R3);
  1032.   uint16_t posR4=map(u,0,255,0,NUM_LEDS_R4);
  1033.  
  1034.   uint16_t posL1=map(u,0,255,0,NUM_LEDS_L1);
  1035.   uint16_t posL2=map(u,0,255,0,NUM_LEDS_L2);
  1036.   uint16_t posL3=map(u,0,255,0,NUM_LEDS_L3);
  1037.   uint16_t posL4=map(u,0,255,0,NUM_LEDS_L4);
  1038.  
  1039.  leds_R1[posR1] = CHSV(color,255,200);
  1040.  leds_R2[posR2] = CHSV(color,255,200);
  1041.  leds_R3[posR3] = CHSV(color,255,200);
  1042.  leds_R4[posR4] = CHSV(color,255,200);
  1043.  
  1044.  leds_L1[posL1] = CHSV(color,255,200);
  1045.  leds_L2[posL2] = CHSV(color,255,200);
  1046.  leds_L3[posL3] = CHSV(color,255,200);
  1047.  leds_L4[posL4] = CHSV(color,255,200);
  1048.  
  1049.  FastLED.show();
  1050. }
  1051.  
  1052.  
  1053.  
  1054. //////////////////////////////////// JUGGLE ////////////////////////////////////
  1055.  
  1056. void juggle(int color) {
  1057.   // Ajuster variable de couleur de 0 à 255
  1058.  
  1059.   int speedJuggle = 7;
  1060.  
  1061.   // eight colored dots, weaving in and out of sync with each other
  1062.   fadeToBlackBy( leds_R1, NUM_LEDS_R1, 50);
  1063.   fadeToBlackBy( leds_R2, NUM_LEDS_R2, 50);
  1064.   fadeToBlackBy( leds_R3, NUM_LEDS_R3, 50);
  1065.   fadeToBlackBy( leds_R4, NUM_LEDS_R4, 50);
  1066.   fadeToBlackBy( leds_L1, NUM_LEDS_L1, 50);
  1067.   fadeToBlackBy( leds_L2, NUM_LEDS_L2, 50);
  1068.   fadeToBlackBy( leds_L3, NUM_LEDS_L3, 50);
  1069.   fadeToBlackBy( leds_L4, NUM_LEDS_L4, 50);
  1070.  
  1071.   byte dothue = 0;
  1072.   for( int i = 0; i < speedJuggle; i++) {
  1073.     leds_R1[beatsin16( i+1, 0, NUM_LEDS_R1-1 )] |= CHSV(color, 255, 255);
  1074.     dothue += 32;
  1075.   }
  1076.  
  1077.   for( int i = 0; i < speedJuggle; i++) {
  1078.     leds_R2[beatsin16( i+1, 0, NUM_LEDS_R1-1 )] |= CHSV(color, 255, 255);
  1079.     dothue += 32;
  1080.   }
  1081.  
  1082.   for( int i = 0; i < speedJuggle; i++) {
  1083.     leds_R3[beatsin16( i+1, 0, NUM_LEDS_R3-1 )] |= CHSV(color, 255, 255);
  1084.     dothue += 32;
  1085.   }
  1086.  
  1087.   for( int i = 0; i < speedJuggle; i++) {
  1088.     leds_R4[beatsin16( i+1, 0, NUM_LEDS_R4-1 )] |= CHSV(color, 255, 255);
  1089.     dothue += 32;
  1090.   }
  1091.  
  1092.   for( int i = 0; i < speedJuggle; i++) {
  1093.     leds_L1[beatsin16( i+1, 0, NUM_LEDS_L1-1 )] |= CHSV(color, 255, 255);
  1094.     dothue += 32;
  1095.   }
  1096.  
  1097.   for( int i = 0; i < speedJuggle; i++) {
  1098.     leds_L2[beatsin16( i+1, 0, NUM_LEDS_L2-1 )] |= CHSV(color, 255, 255);
  1099.     dothue += 32;
  1100.   }
  1101.  
  1102.   for( int i = 0; i < speedJuggle; i++) {
  1103.     leds_L3[beatsin16( i+1, 0, NUM_LEDS_L3-1 )] |= CHSV(color, 255, 255);
  1104.     dothue += 32;
  1105.   }
  1106.  
  1107.   for( int i = 0; i < speedJuggle; i++) {
  1108.     leds_L4[beatsin16( i+1, 0, NUM_LEDS_L4-1 )] |= CHSV(color, 255, 255);
  1109.     dothue += 32;
  1110.   }
  1111.  
  1112.   FastLED.show();
  1113. }
  1114.  
  1115. ///////////////////////////////////// PALETTES ///////////////////////////////////////
  1116.  
  1117. void palette_changer() {
  1118.   EVERY_N_SECONDS( SECONDS_PER_PALETTE ) {
  1119.     gCurrentPaletteNumber = addmod8( gCurrentPaletteNumber, 1, gGradientPaletteCount);
  1120.     gTargetPalette = gGradientPalettes[ gCurrentPaletteNumber ];
  1121.   }
  1122.  
  1123.   EVERY_N_MILLISECONDS(40) {
  1124.     nblendPaletteTowardPalette( gCurrentPalette, gTargetPalette, 16);
  1125.   }
  1126.  
  1127.   colorwaves( leds_R1, NUM_LEDS_R1, gCurrentPalette);
  1128.   colorwaves( leds_R2, NUM_LEDS_R2, gCurrentPalette);
  1129.   colorwaves( leds_R3, NUM_LEDS_R3, gCurrentPalette);
  1130.   colorwaves( leds_R4, NUM_LEDS_R4, gCurrentPalette);
  1131.  
  1132.   colorwaves( leds_L1, NUM_LEDS_L1, gCurrentPalette);
  1133.   colorwaves( leds_L2, NUM_LEDS_L2, gCurrentPalette);
  1134.   colorwaves( leds_L3, NUM_LEDS_L3, gCurrentPalette);
  1135.   colorwaves( leds_L4, NUM_LEDS_L4, gCurrentPalette);
  1136.  
  1137.   FastLED.show();
  1138.   FastLED.delay(20);
  1139. }
  1140.  
  1141.  
  1142. // This function draws color waves with an ever-changing,
  1143. // widely-varying set of parameters, using a color palette.
  1144. void colorwaves( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette)
  1145. {
  1146.   static uint16_t sPseudotime = 0;
  1147.   static uint16_t sLastMillis = 0;
  1148.   static uint16_t sHue16 = 0;
  1149.  
  1150.   uint8_t sat8 = beatsin88( 87, 220, 250);
  1151.   uint8_t brightdepth = beatsin88( 341, 96, 224);
  1152.   uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
  1153.   uint8_t msmultiplier = beatsin88(147, 23, 60);
  1154.  
  1155.   uint16_t hue16 = sHue16;//gHue * 256;
  1156.   uint16_t hueinc16 = beatsin88(113, 300, 1500);
  1157.  
  1158.   uint16_t ms = millis();
  1159.   uint16_t deltams = ms - sLastMillis ;
  1160.   sLastMillis  = ms;
  1161.   sPseudotime += deltams * msmultiplier;
  1162.   sHue16 += deltams * beatsin88( 400, 5,9);
  1163.   uint16_t brightnesstheta16 = sPseudotime;
  1164.  
  1165.   for( uint16_t i = 0 ; i < numleds; i++) {
  1166.     hue16 += hueinc16;
  1167.     uint8_t hue8 = hue16 / 256;
  1168.     uint16_t h16_128 = hue16 >> 7;
  1169.     if( h16_128 & 0x100) {
  1170.       hue8 = 255 - (h16_128 >> 1);
  1171.     } else {
  1172.       hue8 = h16_128 >> 1;
  1173.     }
  1174.  
  1175.     brightnesstheta16  += brightnessthetainc16;
  1176.     uint16_t b16 = sin16( brightnesstheta16  ) + 32768;
  1177.  
  1178.     uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
  1179.     uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
  1180.     bri8 += (255 - brightdepth);
  1181.    
  1182.     uint8_t index = hue8;
  1183.     //index = triwave8( index);
  1184.     index = scale8( index, 240);
  1185.  
  1186.     CRGB newcolor = ColorFromPalette( palette, index, bri8);
  1187.  
  1188.     uint16_t pixelnumber = i;
  1189.     pixelnumber = (numleds-1) - pixelnumber;
  1190.    
  1191.     nblend( ledarray[pixelnumber], newcolor, 128);
  1192.   }
  1193. }
  1194.  
  1195. // Alternate rendering function just scrolls the current palette
  1196. // across the defined LED strip.
  1197. void palettetest( CRGB* ledarray, uint16_t numleds, const CRGBPalette16& gCurrentPalette)
  1198. {
  1199.   static uint8_t startindex = 0;
  1200.   startindex--;
  1201.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_R1) + 1, gCurrentPalette, 255, LINEARBLEND);
  1202.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_R2) + 1, gCurrentPalette, 255, LINEARBLEND);
  1203.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_R3) + 1, gCurrentPalette, 255, LINEARBLEND);
  1204.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_R4) + 1, gCurrentPalette, 255, LINEARBLEND);
  1205.  
  1206.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_L1) + 1, gCurrentPalette, 255, LINEARBLEND);
  1207.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_L2) + 1, gCurrentPalette, 255, LINEARBLEND);
  1208.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_L3) + 1, gCurrentPalette, 255, LINEARBLEND);
  1209.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS_L4) + 1, gCurrentPalette, 255, LINEARBLEND);
  1210.  
  1211. }
  1212.  
  1213.  
  1214.  
  1215. // Gradient palette "ib_jul01_gp", originally from
  1216. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/xmas/tn/ib_jul01.png.index.html
  1217. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1218. // Size: 16 bytes of program space.
  1219.  
  1220. DEFINE_GRADIENT_PALETTE( ib_jul01_gp ) {
  1221.     0, 194,  1,  1,
  1222.    94,   1, 29, 18,
  1223.   132,  57,131, 28,
  1224.   255, 113,  1,  1};
  1225.  
  1226. // Gradient palette "es_vintage_57_gp", originally from
  1227. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_57.png.index.html
  1228. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1229. // Size: 20 bytes of program space.
  1230.  
  1231. DEFINE_GRADIENT_PALETTE( es_vintage_57_gp ) {
  1232.     0,   2,  1,  1,
  1233.    53,  18,  1,  0,
  1234.   104,  69, 29,  1,
  1235.   153, 167,135, 10,
  1236.   255,  46, 56,  4};
  1237.  
  1238. // Gradient palette "es_vintage_01_gp", originally from
  1239. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_01.png.index.html
  1240. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1241. // Size: 32 bytes of program space.
  1242.  
  1243. DEFINE_GRADIENT_PALETTE( es_vintage_01_gp ) {
  1244.     0,   4,  1,  1,
  1245.    51,  16,  0,  1,
  1246.    76,  97,104,  3,
  1247.   101, 255,131, 19,
  1248.   127,  67,  9,  4,
  1249.   153,  16,  0,  1,
  1250.   229,   4,  1,  1,
  1251.   255,   4,  1,  1};
  1252.  
  1253. // Gradient palette "es_rivendell_15_gp", originally from
  1254. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/rivendell/tn/es_rivendell_15.png.index.html
  1255. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1256. // Size: 20 bytes of program space.
  1257.  
  1258. DEFINE_GRADIENT_PALETTE( es_rivendell_15_gp ) {
  1259.     0,   1, 14,  5,
  1260.   101,  16, 36, 14,
  1261.   165,  56, 68, 30,
  1262.   242, 150,156, 99,
  1263.   255, 150,156, 99};
  1264.  
  1265. // Gradient palette "rgi_15_gp", originally from
  1266. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/rgi/tn/rgi_15.png.index.html
  1267. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1268. // Size: 36 bytes of program space.
  1269.  
  1270. DEFINE_GRADIENT_PALETTE( rgi_15_gp ) {
  1271.     0,   4,  1, 31,
  1272.    31,  55,  1, 16,
  1273.    63, 197,  3,  7,
  1274.    95,  59,  2, 17,
  1275.   127,   6,  2, 34,
  1276.   159,  39,  6, 33,
  1277.   191, 112, 13, 32,
  1278.   223,  56,  9, 35,
  1279.   255,  22,  6, 38};
  1280.  
  1281. // Gradient palette "retro2_16_gp", originally from
  1282. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/retro2/tn/retro2_16.png.index.html
  1283. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1284. // Size: 8 bytes of program space.
  1285.  
  1286. DEFINE_GRADIENT_PALETTE( retro2_16_gp ) {
  1287.     0, 188,135,  1,
  1288.   255,  46,  7,  1};
  1289.  
  1290. // Gradient palette "Analogous_1_gp", originally from
  1291. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/red/tn/Analogous_1.png.index.html
  1292. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1293. // Size: 20 bytes of program space.
  1294.  
  1295. DEFINE_GRADIENT_PALETTE( Analogous_1_gp ) {
  1296.     0,   3,  0,255,
  1297.    63,  23,  0,255,
  1298.   127,  67,  0,255,
  1299.   191, 142,  0, 45,
  1300.   255, 255,  0,  0};
  1301.  
  1302. // Gradient palette "es_pinksplash_08_gp", originally from
  1303. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_08.png.index.html
  1304. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1305. // Size: 20 bytes of program space.
  1306.  
  1307. DEFINE_GRADIENT_PALETTE( es_pinksplash_08_gp ) {
  1308.     0, 126, 11,255,
  1309.   127, 197,  1, 22,
  1310.   175, 210,157,172,
  1311.   221, 157,  3,112,
  1312.   255, 157,  3,112};
  1313.  
  1314. // Gradient palette "es_pinksplash_07_gp", originally from
  1315. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_07.png.index.html
  1316. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1317. // Size: 28 bytes of program space.
  1318.  
  1319. DEFINE_GRADIENT_PALETTE( es_pinksplash_07_gp ) {
  1320.     0, 229,  1,  1,
  1321.    61, 242,  4, 63,
  1322.   101, 255, 12,255,
  1323.   127, 249, 81,252,
  1324.   153, 255, 11,235,
  1325.   193, 244,  5, 68,
  1326.   255, 232,  1,  5};
  1327.  
  1328. // Gradient palette "Coral_reef_gp", originally from
  1329. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/other/tn/Coral_reef.png.index.html
  1330. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1331. // Size: 24 bytes of program space.
  1332.  
  1333. DEFINE_GRADIENT_PALETTE( Coral_reef_gp ) {
  1334.     0,  40,199,197,
  1335.    50,  10,152,155,
  1336.    96,   1,111,120,
  1337.    96,  43,127,162,
  1338.   139,  10, 73,111,
  1339.   255,   1, 34, 71};
  1340.  
  1341. // Gradient palette "es_ocean_breeze_068_gp", originally from
  1342. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_068.png.index.html
  1343. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1344. // Size: 24 bytes of program space.
  1345.  
  1346. DEFINE_GRADIENT_PALETTE( es_ocean_breeze_068_gp ) {
  1347.     0, 100,156,153,
  1348.    51,   1, 99,137,
  1349.   101,   1, 68, 84,
  1350.   104,  35,142,168,
  1351.   178,   0, 63,117,
  1352.   255,   1, 10, 10};
  1353.  
  1354. // Gradient palette "es_ocean_breeze_036_gp", originally from
  1355. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_036.png.index.html
  1356. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1357. // Size: 16 bytes of program space.
  1358.  
  1359. DEFINE_GRADIENT_PALETTE( es_ocean_breeze_036_gp ) {
  1360.     0,   1,  6,  7,
  1361.    89,   1, 99,111,
  1362.   153, 144,209,255,
  1363.   255,   0, 73, 82};
  1364.  
  1365. // Gradient palette "departure_gp", originally from
  1366. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/mjf/tn/departure.png.index.html
  1367. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1368. // Size: 88 bytes of program space.
  1369.  
  1370. DEFINE_GRADIENT_PALETTE( departure_gp ) {
  1371.     0,   8,  3,  0,
  1372.    42,  23,  7,  0,
  1373.    63,  75, 38,  6,
  1374.    84, 169, 99, 38,
  1375.   106, 213,169,119,
  1376.   116, 255,255,255,
  1377.   138, 135,255,138,
  1378.   148,  22,255, 24,
  1379.   170,   0,255,  0,
  1380.   191,   0,136,  0,
  1381.   212,   0, 55,  0,
  1382.   255,   0, 55,  0};
  1383.  
  1384. // Gradient palette "es_landscape_64_gp", originally from
  1385. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_64.png.index.html
  1386. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1387. // Size: 36 bytes of program space.
  1388.  
  1389. DEFINE_GRADIENT_PALETTE( es_landscape_64_gp ) {
  1390.     0,   0,  0,  0,
  1391.    37,   2, 25,  1,
  1392.    76,  15,115,  5,
  1393.   127,  79,213,  1,
  1394.   128, 126,211, 47,
  1395.   130, 188,209,247,
  1396.   153, 144,182,205,
  1397.   204,  59,117,250,
  1398.   255,   1, 37,192};
  1399.  
  1400. // Gradient palette "es_landscape_33_gp", originally from
  1401. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_33.png.index.html
  1402. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1403. // Size: 24 bytes of program space.
  1404.  
  1405. DEFINE_GRADIENT_PALETTE( es_landscape_33_gp ) {
  1406.     0,   1,  5,  0,
  1407.    19,  32, 23,  1,
  1408.    38, 161, 55,  1,
  1409.    63, 229,144,  1,
  1410.    66,  39,142, 74,
  1411.   255,   1,  4,  1};
  1412.  
  1413. // Gradient palette "rainbowsherbet_gp", originally from
  1414. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/icecream/tn/rainbowsherbet.png.index.html
  1415. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1416. // Size: 28 bytes of program space.
  1417.  
  1418. DEFINE_GRADIENT_PALETTE( rainbowsherbet_gp ) {
  1419.     0, 255, 33,  4,
  1420.    43, 255, 68, 25,
  1421.    86, 255,  7, 25,
  1422.   127, 255, 82,103,
  1423.   170, 255,255,242,
  1424.   209,  42,255, 22,
  1425.   255,  87,255, 65};
  1426.  
  1427. // Gradient palette "gr65_hult_gp", originally from
  1428. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr65_hult.png.index.html
  1429. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1430. // Size: 24 bytes of program space.
  1431.  
  1432. DEFINE_GRADIENT_PALETTE( gr65_hult_gp ) {
  1433.     0, 247,176,247,
  1434.    48, 255,136,255,
  1435.    89, 220, 29,226,
  1436.   160,   7, 82,178,
  1437.   216,   1,124,109,
  1438.   255,   1,124,109};
  1439.  
  1440. // Gradient palette "gr64_hult_gp", originally from
  1441. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr64_hult.png.index.html
  1442. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1443. // Size: 32 bytes of program space.
  1444.  
  1445. DEFINE_GRADIENT_PALETTE( gr64_hult_gp ) {
  1446.     0,   1,124,109,
  1447.    66,   1, 93, 79,
  1448.   104,  52, 65,  1,
  1449.   130, 115,127,  1,
  1450.   150,  52, 65,  1,
  1451.   201,   1, 86, 72,
  1452.   239,   0, 55, 45,
  1453.   255,   0, 55, 45};
  1454.  
  1455. // Gradient palette "GMT_drywet_gp", originally from
  1456. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/gmt/tn/GMT_drywet.png.index.html
  1457. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1458. // Size: 28 bytes of program space.
  1459.  
  1460. DEFINE_GRADIENT_PALETTE( GMT_drywet_gp ) {
  1461.     0,  47, 30,  2,
  1462.    42, 213,147, 24,
  1463.    84, 103,219, 52,
  1464.   127,   3,219,207,
  1465.   170,   1, 48,214,
  1466.   212,   1,  1,111,
  1467.   255,   1,  7, 33};
  1468.  
  1469. // Gradient palette "ib15_gp", originally from
  1470. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/general/tn/ib15.png.index.html
  1471. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1472. // Size: 24 bytes of program space.
  1473.  
  1474. DEFINE_GRADIENT_PALETTE( ib15_gp ) {
  1475.     0, 113, 91,147,
  1476.    72, 157, 88, 78,
  1477.    89, 208, 85, 33,
  1478.   107, 255, 29, 11,
  1479.   141, 137, 31, 39,
  1480.   255,  59, 33, 89};
  1481.  
  1482. // Gradient palette "Fuschia_7_gp", originally from
  1483. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/fuschia/tn/Fuschia-7.png.index.html
  1484. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1485. // Size: 20 bytes of program space.
  1486.  
  1487. DEFINE_GRADIENT_PALETTE( Fuschia_7_gp ) {
  1488.     0,  43,  3,153,
  1489.    63, 100,  4,103,
  1490.   127, 188,  5, 66,
  1491.   191, 161, 11,115,
  1492.   255, 135, 20,182};
  1493.  
  1494. // Gradient palette "es_emerald_dragon_08_gp", originally from
  1495. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/emerald_dragon/tn/es_emerald_dragon_08.png.index.html
  1496. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1497. // Size: 16 bytes of program space.
  1498.  
  1499. DEFINE_GRADIENT_PALETTE( es_emerald_dragon_08_gp ) {
  1500.     0,  97,255,  1,
  1501.   101,  47,133,  1,
  1502.   178,  13, 43,  1,
  1503.   255,   2, 10,  1};
  1504.  
  1505. // Gradient palette "lava_gp", originally from
  1506. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/lava.png.index.html
  1507. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1508. // Size: 52 bytes of program space.
  1509.  
  1510. DEFINE_GRADIENT_PALETTE( lava_gp ) {
  1511.     0,   0,  0,  0,
  1512.    46,  18,  0,  0,
  1513.    96, 113,  0,  0,
  1514.   108, 142,  3,  1,
  1515.   119, 175, 17,  1,
  1516.   146, 213, 44,  2,
  1517.   174, 255, 82,  4,
  1518.   188, 255,115,  4,
  1519.   202, 255,156,  4,
  1520.   218, 255,203,  4,
  1521.   234, 255,255,  4,
  1522.   244, 255,255, 71,
  1523.   255, 255,255,255};
  1524.  
  1525. // Gradient palette "fire_gp", originally from
  1526. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/fire.png.index.html
  1527. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1528. // Size: 28 bytes of program space.
  1529.  
  1530. DEFINE_GRADIENT_PALETTE( fire_gp ) {
  1531.     0,   1,  1,  0,
  1532.    76,  32,  5,  0,
  1533.   146, 192, 24,  0,
  1534.   197, 220,105,  5,
  1535.   240, 252,255, 31,
  1536.   250, 252,255,111,
  1537.   255, 255,255,255};
  1538.  
  1539. // Gradient palette "Colorfull_gp", originally from
  1540. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Colorfull.png.index.html
  1541. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1542. // Size: 44 bytes of program space.
  1543.  
  1544. DEFINE_GRADIENT_PALETTE( Colorfull_gp ) {
  1545.     0,  10, 85,  5,
  1546.    25,  29,109, 18,
  1547.    60,  59,138, 42,
  1548.    93,  83, 99, 52,
  1549.   106, 110, 66, 64,
  1550.   109, 123, 49, 65,
  1551.   113, 139, 35, 66,
  1552.   116, 192,117, 98,
  1553.   124, 255,255,137,
  1554.   168, 100,180,155,
  1555.   255,  22,121,174};
  1556.  
  1557. // Gradient palette "Magenta_Evening_gp", originally from
  1558. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Magenta_Evening.png.index.html
  1559. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1560. // Size: 28 bytes of program space.
  1561.  
  1562. DEFINE_GRADIENT_PALETTE( Magenta_Evening_gp ) {
  1563.     0,  71, 27, 39,
  1564.    31, 130, 11, 51,
  1565.    63, 213,  2, 64,
  1566.    70, 232,  1, 66,
  1567.    76, 252,  1, 69,
  1568.   108, 123,  2, 51,
  1569.   255,  46,  9, 35};
  1570.  
  1571. // Gradient palette "Pink_Purple_gp", originally from
  1572. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Pink_Purple.png.index.html
  1573. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1574. // Size: 44 bytes of program space.
  1575.  
  1576. DEFINE_GRADIENT_PALETTE( Pink_Purple_gp ) {
  1577.     0,  19,  2, 39,
  1578.    25,  26,  4, 45,
  1579.    51,  33,  6, 52,
  1580.    76,  68, 62,125,
  1581.   102, 118,187,240,
  1582.   109, 163,215,247,
  1583.   114, 217,244,255,
  1584.   122, 159,149,221,
  1585.   149, 113, 78,188,
  1586.   183, 128, 57,155,
  1587.   255, 146, 40,123};
  1588.  
  1589. // Gradient palette "Sunset_Real_gp", originally from
  1590. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Sunset_Real.png.index.html
  1591. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1592. // Size: 28 bytes of program space.
  1593.  
  1594. DEFINE_GRADIENT_PALETTE( Sunset_Real_gp ) {
  1595.     0, 120,  0,  0,
  1596.    22, 179, 22,  0,
  1597.    51, 255,104,  0,
  1598.    85, 167, 22, 18,
  1599.   135, 100,  0,103,
  1600.   198,  16,  0,130,
  1601.   255,   0,  0,160};
  1602.  
  1603. // Gradient palette "es_autumn_19_gp", originally from
  1604. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/autumn/tn/es_autumn_19.png.index.html
  1605. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1606. // Size: 52 bytes of program space.
  1607.  
  1608. DEFINE_GRADIENT_PALETTE( es_autumn_19_gp ) {
  1609.     0,  26,  1,  1,
  1610.    51,  67,  4,  1,
  1611.    84, 118, 14,  1,
  1612.   104, 137,152, 52,
  1613.   112, 113, 65,  1,
  1614.   122, 133,149, 59,
  1615.   124, 137,152, 52,
  1616.   135, 113, 65,  1,
  1617.   142, 139,154, 46,
  1618.   163, 113, 13,  1,
  1619.   204,  55,  3,  1,
  1620.   249,  17,  1,  1,
  1621.   255,  17,  1,  1};
  1622.  
  1623. // Gradient palette "BlacK_Blue_Magenta_White_gp", originally from
  1624. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Blue_Magenta_White.png.index.html
  1625. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1626. // Size: 28 bytes of program space.
  1627.  
  1628. DEFINE_GRADIENT_PALETTE( BlacK_Blue_Magenta_White_gp ) {
  1629.     0,   0,  0,  0,
  1630.    42,   0,  0, 45,
  1631.    84,   0,  0,255,
  1632.   127,  42,  0,255,
  1633.   170, 255,  0,255,
  1634.   212, 255, 55,255,
  1635.   255, 255,255,255};
  1636.  
  1637. // Gradient palette "BlacK_Magenta_Red_gp", originally from
  1638. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Magenta_Red.png.index.html
  1639. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1640. // Size: 20 bytes of program space.
  1641.  
  1642. DEFINE_GRADIENT_PALETTE( BlacK_Magenta_Red_gp ) {
  1643.     0,   0,  0,  0,
  1644.    63,  42,  0, 45,
  1645.   127, 255,  0,255,
  1646.   191, 255,  0, 45,
  1647.   255, 255,  0,  0};
  1648.  
  1649. // Gradient palette "BlacK_Red_Magenta_Yellow_gp", originally from
  1650. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Red_Magenta_Yellow.png.index.html
  1651. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1652. // Size: 28 bytes of program space.
  1653.  
  1654. DEFINE_GRADIENT_PALETTE( BlacK_Red_Magenta_Yellow_gp ) {
  1655.     0,   0,  0,  0,
  1656.    42,  42,  0,  0,
  1657.    84, 255,  0,  0,
  1658.   127, 255,  0, 45,
  1659.   170, 255,  0,255,
  1660.   212, 255, 55, 45,
  1661.   255, 255,255,  0};
  1662.  
  1663. // Gradient palette "Blue_Cyan_Yellow_gp", originally from
  1664. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/Blue_Cyan_Yellow.png.index.html
  1665. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  1666. // Size: 20 bytes of program space.
  1667.  
  1668. DEFINE_GRADIENT_PALETTE( Blue_Cyan_Yellow_gp ) {
  1669.     0,   0,  0,255,
  1670.    63,   0, 55,255,
  1671.   127,   0,255,255,
  1672.   191,  42,255, 45,
  1673.   255, 255,255,  0};
  1674.  
  1675.  
  1676. // Single array of defined cpt-city color palettes.
  1677. // This will let us programmatically choose one based on
  1678. // a number, rather than having to activate each explicitly
  1679. // by name every time.
  1680. // Since it is const, this array could also be moved
  1681. // into PROGMEM to save SRAM, but for simplicity of illustration
  1682. // we'll keep it in a regular SRAM array.
  1683. //
  1684. // This list of color palettes acts as a "playlist"; you can
  1685. // add or delete, or re-arrange as you wish.
  1686. const TProgmemRGBGradientPalettePtr gGradientPalettes[] = {
  1687.   Sunset_Real_gp,
  1688.   es_rivendell_15_gp,
  1689.   es_ocean_breeze_036_gp,
  1690.   rgi_15_gp,
  1691.   retro2_16_gp,
  1692.   Analogous_1_gp,
  1693.   es_pinksplash_08_gp,
  1694.   Coral_reef_gp,
  1695.   es_ocean_breeze_068_gp,
  1696.   es_pinksplash_07_gp,
  1697.   es_vintage_01_gp,
  1698.   departure_gp,
  1699.   es_landscape_64_gp,
  1700.   es_landscape_33_gp,
  1701.   rainbowsherbet_gp,
  1702.   gr65_hult_gp,
  1703.   gr64_hult_gp,
  1704.   GMT_drywet_gp,
  1705.   ib_jul01_gp,
  1706.   es_vintage_57_gp,
  1707.   ib15_gp,
  1708.   Fuschia_7_gp,
  1709.   es_emerald_dragon_08_gp,
  1710.   lava_gp,
  1711.   fire_gp,
  1712.   Colorfull_gp,
  1713.   Magenta_Evening_gp,
  1714.   Pink_Purple_gp,
  1715.   es_autumn_19_gp,
  1716.   BlacK_Blue_Magenta_White_gp,
  1717.   BlacK_Magenta_Red_gp,
  1718.   BlacK_Red_Magenta_Yellow_gp,
  1719.   Blue_Cyan_Yellow_gp };
  1720.  
  1721.  
  1722. // Count of how many cpt-city gradients are defined:
  1723. const uint8_t gGradientPaletteCount =
  1724.   sizeof( gGradientPalettes) / sizeof( TProgmemRGBGradientPalettePtr );
  1725.  
Add Comment
Please, Sign In to add comment