Advertisement
Guest User

Untitled

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