Guest User

Dreamstate

a guest
Nov 29th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 20.08 KB | None | 0 0
  1. #include "FastLED.h"
  2.  
  3. // ColorWavesWithPalettes
  4. // Animated shifting color waves, with several cross-fading color palettes.
  5. // by Mark Kriegsman, August 2015
  6. //
  7. // Color palettes courtesy of cpt-city and its contributors:
  8. //   http://soliton.vm.bytemark.co.uk/pub/cpt-city/
  9. //
  10. // Color palettes converted for FastLED using "PaletteKnife" v1:
  11. //   http://fastled.io/tools/paletteknife/
  12. //
  13.  
  14. #if FASTLED_VERSION < 3001000
  15. #error "Requires FastLED 3.1 or later; check github for latest code."
  16. #endif
  17.  
  18. #define DATA_PIN    12
  19. //#define CLK_PIN   4
  20. #define LED_TYPE    WS2811
  21. #define COLOR_ORDER GRB
  22. #define NUM_LEDS    300
  23. #define BRIGHTNESS  100
  24.  
  25. CRGB leds[NUM_LEDS];
  26.  
  27. // ten seconds per color palette makes a good demo
  28. // 20-120 is better for deployment
  29. #define SECONDS_PER_PALETTE 10
  30.  
  31.  
  32. void setup() {
  33.   delay(3000); // 3 second delay for recovery
  34.  
  35.   // tell FastLED about the LED strip configuration
  36.   FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS)
  37.     //.setCorrection(TypicalLEDStrip) // cpt-city palettes have different color balance
  38.     .setDither(BRIGHTNESS < 255);
  39.  
  40.   // set master brightness control
  41.   FastLED.setBrightness(BRIGHTNESS);
  42.   Serial.begin(9600);
  43. }
  44.  
  45. // Forward declarations of an array of cpt-city gradient palettes, and
  46. // a count of how many there are.  The actual color palette definitions
  47. // are at the bottom of this file.
  48. extern const TProgmemRGBGradientPalettePtr gGradientPalettes[];
  49. extern const uint8_t gGradientPaletteCount;
  50.  
  51. // Current palette number from the 'playlist' of color palettes
  52. uint8_t gCurrentPaletteNumber = 0;
  53.  
  54. CRGBPalette16 gCurrentPalette( CRGB::Black);
  55. CRGBPalette16 gTargetPalette( gGradientPalettes[0] );
  56.  
  57.  
  58. void loop()
  59. {
  60.   EVERY_N_SECONDS( SECONDS_PER_PALETTE ) {
  61.     gCurrentPaletteNumber = addmod8( gCurrentPaletteNumber, 1, gGradientPaletteCount);
  62.     gTargetPalette = gGradientPalettes[ gCurrentPaletteNumber ];
  63.   }
  64.  
  65.   EVERY_N_MILLISECONDS(40) {
  66.     nblendPaletteTowardPalette( gCurrentPalette, gTargetPalette, 16);
  67.   }
  68.  
  69.   colorwaves( leds, NUM_LEDS, gCurrentPalette);
  70.  
  71.   FastLED.show();
  72.   FastLED.delay(20);
  73.   Serial.println(gCurrentPaletteNumber);
  74. }
  75.  
  76.  
  77. // This function draws color waves with an ever-changing,
  78. // widely-varying set of parameters, using a color palette.
  79. void colorwaves( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette)
  80. {
  81.   static uint16_t sPseudotime = 0;
  82.   static uint16_t sLastMillis = 0;
  83.   static uint16_t sHue16 = 0;
  84.  
  85.   uint8_t sat8 = beatsin88( 87, 220, 250);
  86.   uint8_t brightdepth = beatsin88( 341, 96, 224);
  87.   uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
  88.   uint8_t msmultiplier = beatsin88(147, 23, 60);
  89.  
  90.   uint16_t hue16 = sHue16;//gHue * 256;
  91.   uint16_t hueinc16 = beatsin88(113, 300, 1500);
  92.  
  93.   uint16_t ms = millis();
  94.   uint16_t deltams = ms - sLastMillis ;
  95.   sLastMillis  = ms;
  96.   sPseudotime += deltams * msmultiplier;
  97.   sHue16 += deltams * beatsin88( 400, 5,9);
  98.   uint16_t brightnesstheta16 = sPseudotime;
  99.  
  100.   for( uint16_t i = 0 ; i < numleds; i++) {
  101.     hue16 += hueinc16;
  102.     uint8_t hue8 = hue16 / 256;
  103.     uint16_t h16_128 = hue16 >> 7;
  104.     if( h16_128 & 0x100) {
  105.       hue8 = 255 - (h16_128 >> 1);
  106.     } else {
  107.       hue8 = h16_128 >> 1;
  108.     }
  109.  
  110.     brightnesstheta16  += brightnessthetainc16;
  111.     uint16_t b16 = sin16( brightnesstheta16  ) + 32768;
  112.  
  113.     uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
  114.     uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
  115.     bri8 += (255 - brightdepth);
  116.    
  117.     uint8_t index = hue8;
  118.     //index = triwave8( index);
  119.     index = scale8( index, 240);
  120.  
  121.     CRGB newcolor = ColorFromPalette( palette, index, bri8);
  122.  
  123.     uint16_t pixelnumber = i;
  124.     pixelnumber = (numleds-1) - pixelnumber;
  125.    
  126.     nblend( ledarray[pixelnumber], newcolor, 128);
  127.   }
  128. }
  129.  
  130. // Alternate rendering function just scrolls the current palette
  131. // across the defined LED strip.
  132. void palettetest( CRGB* ledarray, uint16_t numleds, const CRGBPalette16& gCurrentPalette)
  133. {
  134.   static uint8_t startindex = 0;
  135.   startindex--;
  136.   fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS) + 1, gCurrentPalette, 255, LINEARBLEND);
  137. }
  138.  
  139.  
  140.  
  141.  
  142.  
  143. // Gradient Color Palette definitions for 33 different cpt-city color palettes.
  144. //    956 bytes of PROGMEM for all of the palettes together,
  145. //   +618 bytes of PROGMEM for gradient palette code (AVR).
  146. //  1,494 bytes total for all 34 color palettes and associated code.
  147.  
  148. // Gradient palette "ib_jul01_gp", originally from
  149. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/xmas/tn/ib_jul01.png.index.html
  150. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  151. // Size: 16 bytes of program space.
  152.  
  153. DEFINE_GRADIENT_PALETTE( ib_jul01_gp ) {
  154.     0, 194,  1,  1,
  155.    94,   1, 29, 18,
  156.   132,  57,131, 28,
  157.   255, 113,  1,  1};
  158.  
  159. // Gradient palette "es_vintage_57_gp", originally from
  160. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_57.png.index.html
  161. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  162. // Size: 20 bytes of program space.
  163.  
  164. DEFINE_GRADIENT_PALETTE( es_vintage_57_gp ) {
  165.     0,   2,  1,  1,
  166.    53,  18,  1,  0,
  167.   104,  69, 29,  1,
  168.   153, 167,135, 10,
  169.   255,  46, 56,  4};
  170.  
  171. // Gradient palette "es_vintage_01_gp", originally from
  172. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_01.png.index.html
  173. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  174. // Size: 32 bytes of program space.
  175.  
  176. DEFINE_GRADIENT_PALETTE( es_vintage_01_gp ) {
  177.     0,   4,  1,  1,
  178.    51,  16,  0,  1,
  179.    76,  97,104,  3,
  180.   101, 255,131, 19,
  181.   127,  67,  9,  4,
  182.   153,  16,  0,  1,
  183.   229,   4,  1,  1,
  184.   255,   4,  1,  1};
  185.  
  186. // Gradient palette "es_rivendell_15_gp", originally from
  187. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/rivendell/tn/es_rivendell_15.png.index.html
  188. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  189. // Size: 20 bytes of program space.
  190.  
  191. DEFINE_GRADIENT_PALETTE( es_rivendell_15_gp ) {
  192.     0,   1, 14,  5,
  193.   101,  16, 36, 14,
  194.   165,  56, 68, 30,
  195.   242, 150,156, 99,
  196.   255, 150,156, 99};
  197.  
  198. // Gradient palette "rgi_15_gp", originally from
  199. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/rgi/tn/rgi_15.png.index.html
  200. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  201. // Size: 36 bytes of program space.
  202.  
  203. DEFINE_GRADIENT_PALETTE( rgi_15_gp ) {
  204.     0,   4,  1, 31,
  205.    31,  55,  1, 16,
  206.    63, 197,  3,  7,
  207.    95,  59,  2, 17,
  208.   127,   6,  2, 34,
  209.   159,  39,  6, 33,
  210.   191, 112, 13, 32,
  211.   223,  56,  9, 35,
  212.   255,  22,  6, 38};
  213.  
  214. // Gradient palette "retro2_16_gp", originally from
  215. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/retro2/tn/retro2_16.png.index.html
  216. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  217. // Size: 8 bytes of program space.
  218.  
  219. DEFINE_GRADIENT_PALETTE( retro2_16_gp ) {
  220.     0, 188,135,  1,
  221.   255,  46,  7,  1};
  222.  
  223. // Gradient palette "Analogous_1_gp", originally from
  224. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/red/tn/Analogous_1.png.index.html
  225. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  226. // Size: 20 bytes of program space.
  227.  
  228. DEFINE_GRADIENT_PALETTE( Analogous_1_gp ) {
  229.     0,   3,  0,255,
  230.    63,  23,  0,255,
  231.   127,  67,  0,255,
  232.   191, 142,  0, 45,
  233.   255, 255,  0,  0};
  234.  
  235. // Gradient palette "es_pinksplash_08_gp", originally from
  236. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_08.png.index.html
  237. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  238. // Size: 20 bytes of program space.
  239.  
  240. DEFINE_GRADIENT_PALETTE( es_pinksplash_08_gp ) {
  241.     0, 126, 11,255,
  242.   127, 197,  1, 22,
  243.   175, 210,157,172,
  244.   221, 157,  3,112,
  245.   255, 157,  3,112};
  246.  
  247. // Gradient palette "es_pinksplash_07_gp", originally from
  248. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_07.png.index.html
  249. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  250. // Size: 28 bytes of program space.
  251.  
  252. DEFINE_GRADIENT_PALETTE( es_pinksplash_07_gp ) {
  253.     0, 229,  1,  1,
  254.    61, 242,  4, 63,
  255.   101, 255, 12,255,
  256.   127, 249, 81,252,
  257.   153, 255, 11,235,
  258.   193, 244,  5, 68,
  259.   255, 232,  1,  5};
  260.  
  261. // Gradient palette "Coral_reef_gp", originally from
  262. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/other/tn/Coral_reef.png.index.html
  263. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  264. // Size: 24 bytes of program space.
  265.  
  266. DEFINE_GRADIENT_PALETTE( Coral_reef_gp ) {
  267.     0,  40,199,197,
  268.    50,  10,152,155,
  269.    96,   1,111,120,
  270.    96,  43,127,162,
  271.   139,  10, 73,111,
  272.   255,   1, 34, 71};
  273.  
  274. // Gradient palette "es_ocean_breeze_068_gp", originally from
  275. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_068.png.index.html
  276. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  277. // Size: 24 bytes of program space.
  278.  
  279. DEFINE_GRADIENT_PALETTE( es_ocean_breeze_068_gp ) {
  280.     0, 100,156,153,
  281.    51,   1, 99,137,
  282.   101,   1, 68, 84,
  283.   104,  35,142,168,
  284.   178,   0, 63,117,
  285.   255,   1, 10, 10};
  286.  
  287. // Gradient palette "es_ocean_breeze_036_gp", originally from
  288. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_036.png.index.html
  289. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  290. // Size: 16 bytes of program space.
  291.  
  292. DEFINE_GRADIENT_PALETTE( es_ocean_breeze_036_gp ) {
  293.     0,   1,  6,  7,
  294.    89,   1, 99,111,
  295.   153, 144,209,255,
  296.   255,   0, 73, 82};
  297.  
  298. // Gradient palette "departure_gp", originally from
  299. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/mjf/tn/departure.png.index.html
  300. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  301. // Size: 88 bytes of program space.
  302.  
  303. DEFINE_GRADIENT_PALETTE( departure_gp ) {
  304.     0,   8,  3,  0,
  305.    42,  23,  7,  0,
  306.    63,  75, 38,  6,
  307.    84, 169, 99, 38,
  308.   106, 213,169,119,
  309.   116, 255,255,255,
  310.   138, 135,255,138,
  311.   148,  22,255, 24,
  312.   170,   0,255,  0,
  313.   191,   0,136,  0,
  314.   212,   0, 55,  0,
  315.   255,   0, 55,  0};
  316.  
  317. // Gradient palette "es_landscape_64_gp", originally from
  318. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_64.png.index.html
  319. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  320. // Size: 36 bytes of program space.
  321.  
  322. DEFINE_GRADIENT_PALETTE( es_landscape_64_gp ) {
  323.     0,   0,  0,  0,
  324.    37,   2, 25,  1,
  325.    76,  15,115,  5,
  326.   127,  79,213,  1,
  327.   128, 126,211, 47,
  328.   130, 188,209,247,
  329.   153, 144,182,205,
  330.   204,  59,117,250,
  331.   255,   1, 37,192};
  332.  
  333. // Gradient palette "es_landscape_33_gp", originally from
  334. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_33.png.index.html
  335. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  336. // Size: 24 bytes of program space.
  337.  
  338. DEFINE_GRADIENT_PALETTE( es_landscape_33_gp ) {
  339.     0,   1,  5,  0,
  340.    19,  32, 23,  1,
  341.    38, 161, 55,  1,
  342.    63, 229,144,  1,
  343.    66,  39,142, 74,
  344.   255,   1,  4,  1};
  345.  
  346. // Gradient palette "rainbowsherbet_gp", originally from
  347. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/icecream/tn/rainbowsherbet.png.index.html
  348. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  349. // Size: 28 bytes of program space.
  350.  
  351. DEFINE_GRADIENT_PALETTE( rainbowsherbet_gp ) {
  352.     0, 255, 33,  4,
  353.    43, 255, 68, 25,
  354.    86, 255,  7, 25,
  355.   127, 255, 82,103,
  356.   170, 255,255,242,
  357.   209,  42,255, 22,
  358.   255,  87,255, 65};
  359.  
  360. // Gradient palette "gr65_hult_gp", originally from
  361. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr65_hult.png.index.html
  362. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  363. // Size: 24 bytes of program space.
  364.  
  365. DEFINE_GRADIENT_PALETTE( gr65_hult_gp ) {
  366.     0, 247,176,247,
  367.    48, 255,136,255,
  368.    89, 220, 29,226,
  369.   160,   7, 82,178,
  370.   216,   1,124,109,
  371.   255,   1,124,109};
  372.  
  373. // Gradient palette "gr64_hult_gp", originally from
  374. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr64_hult.png.index.html
  375. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  376. // Size: 32 bytes of program space.
  377.  
  378. DEFINE_GRADIENT_PALETTE( gr64_hult_gp ) {
  379.     0,   1,124,109,
  380.    66,   1, 93, 79,
  381.   104,  52, 65,  1,
  382.   130, 115,127,  1,
  383.   150,  52, 65,  1,
  384.   201,   1, 86, 72,
  385.   239,   0, 55, 45,
  386.   255,   0, 55, 45};
  387.  
  388. // Gradient palette "GMT_drywet_gp", originally from
  389. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/gmt/tn/GMT_drywet.png.index.html
  390. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  391. // Size: 28 bytes of program space.
  392.  
  393. DEFINE_GRADIENT_PALETTE( GMT_drywet_gp ) {
  394.     0,  47, 30,  2,
  395.    42, 213,147, 24,
  396.    84, 103,219, 52,
  397.   127,   3,219,207,
  398.   170,   1, 48,214,
  399.   212,   1,  1,111,
  400.   255,   1,  7, 33};
  401.  
  402. // Gradient palette "ib15_gp", originally from
  403. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/general/tn/ib15.png.index.html
  404. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  405. // Size: 24 bytes of program space.
  406.  
  407. DEFINE_GRADIENT_PALETTE( ib15_gp ) {
  408.     0, 113, 91,147,
  409.    72, 157, 88, 78,
  410.    89, 208, 85, 33,
  411.   107, 255, 29, 11,
  412.   141, 137, 31, 39,
  413.   255,  59, 33, 89};
  414.  
  415. // Gradient palette "Fuschia_7_gp", originally from
  416. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/fuschia/tn/Fuschia-7.png.index.html
  417. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  418. // Size: 20 bytes of program space.
  419.  
  420. DEFINE_GRADIENT_PALETTE( Fuschia_7_gp ) {
  421.     0,  43,  3,153,
  422.    63, 100,  4,103,
  423.   127, 188,  5, 66,
  424.   191, 161, 11,115,
  425.   255, 135, 20,182};
  426.  
  427. // Gradient palette "es_emerald_dragon_08_gp", originally from
  428. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/emerald_dragon/tn/es_emerald_dragon_08.png.index.html
  429. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  430. // Size: 16 bytes of program space.
  431.  
  432. DEFINE_GRADIENT_PALETTE( es_emerald_dragon_08_gp ) {
  433.     0,  97,255,  1,
  434.   101,  47,133,  1,
  435.   178,  13, 43,  1,
  436.   255,   2, 10,  1};
  437.  
  438. // Gradient palette "lava_gp", originally from
  439. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/lava.png.index.html
  440. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  441. // Size: 52 bytes of program space.
  442.  
  443. DEFINE_GRADIENT_PALETTE( lava_gp ) {
  444.     0,   0,  0,  0,
  445.    46,  18,  0,  0,
  446.    96, 113,  0,  0,
  447.   108, 142,  3,  1,
  448.   119, 175, 17,  1,
  449.   146, 213, 44,  2,
  450.   174, 255, 82,  4,
  451.   188, 255,115,  4,
  452.   202, 255,156,  4,
  453.   218, 255,203,  4,
  454.   234, 255,255,  4,
  455.   244, 255,255, 71,
  456.   255, 255,255,255};
  457.  
  458. // Gradient palette "fire_gp", originally from
  459. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/fire.png.index.html
  460. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  461. // Size: 28 bytes of program space.
  462.  
  463. DEFINE_GRADIENT_PALETTE( fire_gp ) {
  464.     0,   1,  1,  0,
  465.    76,  32,  5,  0,
  466.   146, 192, 24,  0,
  467.   197, 220,105,  5,
  468.   240, 252,255, 31,
  469.   250, 252,255,111,
  470.   255, 255,255,255};
  471.  
  472. // Gradient palette "Colorfull_gp", originally from
  473. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Colorfull.png.index.html
  474. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  475. // Size: 44 bytes of program space.
  476.  
  477. DEFINE_GRADIENT_PALETTE( Colorfull_gp ) {
  478.     0,  10, 85,  5,
  479.    25,  29,109, 18,
  480.    60,  59,138, 42,
  481.    93,  83, 99, 52,
  482.   106, 110, 66, 64,
  483.   109, 123, 49, 65,
  484.   113, 139, 35, 66,
  485.   116, 192,117, 98,
  486.   124, 255,255,137,
  487.   168, 100,180,155,
  488.   255,  22,121,174};
  489.  
  490. // Gradient palette "Magenta_Evening_gp", originally from
  491. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Magenta_Evening.png.index.html
  492. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  493. // Size: 28 bytes of program space.
  494.  
  495. DEFINE_GRADIENT_PALETTE( Magenta_Evening_gp ) {
  496.     0,  71, 27, 39,
  497.    31, 130, 11, 51,
  498.    63, 213,  2, 64,
  499.    70, 232,  1, 66,
  500.    76, 252,  1, 69,
  501.   108, 123,  2, 51,
  502.   255,  46,  9, 35};
  503.  
  504. // Gradient palette "Pink_Purple_gp", originally from
  505. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Pink_Purple.png.index.html
  506. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  507. // Size: 44 bytes of program space.
  508.  
  509. DEFINE_GRADIENT_PALETTE( Pink_Purple_gp ) {
  510.     0,  19,  2, 39,
  511.    25,  26,  4, 45,
  512.    51,  33,  6, 52,
  513.    76,  68, 62,125,
  514.   102, 118,187,240,
  515.   109, 163,215,247,
  516.   114, 217,244,255,
  517.   122, 159,149,221,
  518.   149, 113, 78,188,
  519.   183, 128, 57,155,
  520.   255, 146, 40,123};
  521.  
  522. // Gradient palette "Sunset_Real_gp", originally from
  523. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Sunset_Real.png.index.html
  524. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  525. // Size: 28 bytes of program space.
  526.  
  527. DEFINE_GRADIENT_PALETTE( Sunset_Real_gp ) {
  528.     0, 120,  0,  0,
  529.    22, 179, 22,  0,
  530.    51, 255,104,  0,
  531.    85, 167, 22, 18,
  532.   135, 100,  0,103,
  533.   198,  16,  0,130,
  534.   255,   0,  0,160};
  535.  
  536. // Gradient palette "es_autumn_19_gp", originally from
  537. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/autumn/tn/es_autumn_19.png.index.html
  538. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  539. // Size: 52 bytes of program space.
  540.  
  541. DEFINE_GRADIENT_PALETTE( es_autumn_19_gp ) {
  542.     0,  26,  1,  1,
  543.    51,  67,  4,  1,
  544.    84, 118, 14,  1,
  545.   104, 137,152, 52,
  546.   112, 113, 65,  1,
  547.   122, 133,149, 59,
  548.   124, 137,152, 52,
  549.   135, 113, 65,  1,
  550.   142, 139,154, 46,
  551.   163, 113, 13,  1,
  552.   204,  55,  3,  1,
  553.   249,  17,  1,  1,
  554.   255,  17,  1,  1};
  555.  
  556. // Gradient palette "BlacK_Blue_Magenta_White_gp", originally from
  557. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Blue_Magenta_White.png.index.html
  558. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  559. // Size: 28 bytes of program space.
  560.  
  561. DEFINE_GRADIENT_PALETTE( BlacK_Blue_Magenta_White_gp ) {
  562.     0,   0,  0,  0,
  563.    42,   0,  0, 45,
  564.    84,   0,  0,255,
  565.   127,  42,  0,255,
  566.   170, 255,  0,255,
  567.   212, 255, 55,255,
  568.   255, 255,255,255};
  569.  
  570. // Gradient palette "BlacK_Magenta_Red_gp", originally from
  571. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Magenta_Red.png.index.html
  572. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  573. // Size: 20 bytes of program space.
  574.  
  575. DEFINE_GRADIENT_PALETTE( BlacK_Magenta_Red_gp ) {
  576.     0,   0,  0,  0,
  577.    63,  42,  0, 45,
  578.   127, 255,  0,255,
  579.   191, 255,  0, 45,
  580.   255, 255,  0,  0};
  581.  
  582. // Gradient palette "BlacK_Red_Magenta_Yellow_gp", originally from
  583. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Red_Magenta_Yellow.png.index.html
  584. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  585. // Size: 28 bytes of program space.
  586.  
  587. DEFINE_GRADIENT_PALETTE( BlacK_Red_Magenta_Yellow_gp ) {
  588.     0,   0,  0,  0,
  589.    42,  42,  0,  0,
  590.    84, 255,  0,  0,
  591.   127, 255,  0, 45,
  592.   170, 255,  0,255,
  593.   212, 255, 55, 45,
  594.   255, 255,255,  0};
  595.  
  596. // Gradient palette "Blue_Cyan_Yellow_gp", originally from
  597. // http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/Blue_Cyan_Yellow.png.index.html
  598. // converted for FastLED with gammas (2.6, 2.2, 2.5)
  599. // Size: 20 bytes of program space.
  600.  
  601. DEFINE_GRADIENT_PALETTE( Blue_Cyan_Yellow_gp ) {
  602.     0,   0,  0,255,
  603.    63,   0, 55,255,
  604.   127,   0,255,255,
  605.   191,  42,255, 45,
  606.   255, 255,255,  0};
  607.  
  608.  
  609. // Single array of defined cpt-city color palettes.
  610. // This will let us programmatically choose one based on
  611. // a number, rather than having to activate each explicitly
  612. // by name every time.
  613. // Since it is const, this array could also be moved
  614. // into PROGMEM to save SRAM, but for simplicity of illustration
  615. // we'll keep it in a regular SRAM array.
  616. //
  617. // This list of color palettes acts as a "playlist"; you can
  618. // add or delete, or re-arrange as you wish.
  619. const TProgmemRGBGradientPalettePtr gGradientPalettes[] = {
  620.  
  621.   es_ocean_breeze_036_gp, //2
  622.   rgi_15_gp, //3
  623.   Analogous_1_gp, //5
  624.   es_pinksplash_08_gp, //6
  625.   Coral_reef_gp, //7
  626.   es_ocean_breeze_068_gp, //8
  627.   es_pinksplash_07_gp, //9
  628.   Fuschia_7_gp,//21
  629.   //fire_gp,//24
  630.   Magenta_Evening_gp,//26
  631.   Pink_Purple_gp,//27
  632.   //es_autumn_19_gp,//28
  633.   BlacK_Blue_Magenta_White_gp,//29
  634.   BlacK_Magenta_Red_gp,//30
  635.   Blue_Cyan_Yellow_gp }; //32
  636.   //Sunset_Real_gp, //0
  637.   //es_rivendell_15_gp, //1
  638.   //retro2_16_gp, //4
  639.   //es_vintage_01_gp, //10
  640.   //departure_gp, //11
  641.   //es_landscape_64_gp, //12
  642.   //rainbowsherbet_gp, //14
  643.   //gr65_hult_gp, //15
  644.   //GMT_drywet_gp, //17
  645.   //ib_jul01_gp, //18
  646.   //es_vintage_57_gp, //19
  647.   //ib15_gp,//20
  648.   //es_emerald_dragon_08_gp,//22
  649.   //lava_gp,//23
  650.   //Colorfull_gp,//25
  651.   //BlacK_Red_Magenta_Yellow_gp,//31
  652.   //es_landscape_33_gp, //13
  653.   //gr64_hult_gp, //16
  654.    
  655. // Count of how many cpt-city gradients are defined:
  656. const uint8_t gGradientPaletteCount =
  657.   sizeof( gGradientPalettes) / sizeof( TProgmemRGBGradientPalettePtr );
Advertisement
Add Comment
Please, Sign In to add comment