Advertisement
Guest User

Untitled

a guest
Apr 4th, 2021
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 93.79 KB | None | 0 0
  1. //Spiralight
  2. //Ed's Code
  3. #include <Arduino.h>
  4. #include <IRremoteESP8266.h>
  5. #include <IRrecv.h>
  6. #include <IRutils.h>
  7. #include <FastLED.h>
  8.  
  9.  
  10.  
  11.  
  12.  
  13. //------------------CUSTOMS---------------
  14. //custom colours
  15. #define DEFAULT1R 0
  16. #define DEFAULT1G 0
  17. #define DEFAULT1B 255
  18.  
  19. #define DEFAULT2R 255
  20. #define DEFAULT2G 0
  21. #define DEFAULT2B 0
  22.  
  23.  
  24. // ---------------------------------------
  25.  
  26. const uint16_t kRecvPin = 14;
  27.  
  28. IRrecv irrecv(kRecvPin);
  29.  
  30. decode_results results;
  31. CRGB default_col_1 = CRGB(DEFAULT1R, DEFAULT1G, DEFAULT1B );
  32. CRGB default_col_2 = CRGB(DEFAULT2R, DEFAULT2G, DEFAULT2B);
  33. DEFINE_GRADIENT_PALETTE( redblue_gp ) {
  34. 0, DEFAULT1R, DEFAULT1G, DEFAULT1B, //blue
  35. 128, DEFAULT2R, DEFAULT2G, DEFAULT2B,
  36. 255, DEFAULT1R, DEFAULT1G, DEFAULT1B
  37. }; //red
  38. CRGBPalette16 MC_p = redblue_gp;
  39. DEFINE_GRADIENT_PALETTE( redblue1_gp ) {
  40. 0, DEFAULT1R, DEFAULT1G, DEFAULT1B, //blue
  41. 255, DEFAULT2R, DEFAULT2G, DEFAULT2B
  42.  
  43. }; //red
  44. CRGBPalette16 MC1_p = redblue1_gp;
  45.  
  46. #define NUM_LEDS 61
  47. #define DATA_PIN 3
  48. int static_r = 255;
  49. int static_g = 255;
  50. int static_b = 255;
  51. int brightness = 100;
  52. int anispeed = 50;
  53. long mil;
  54. int r2b = 1;
  55. int b2g;
  56. int g2r;
  57. int rainbow_r;
  58. int rainbow_g;
  59. int rainbow_b;
  60. int rainbow_sp = 2;
  61. int P2S = 1;
  62. int S2P;
  63. int MCFadePos;
  64. float startIndex;
  65. float colorIndex;
  66. int spos;
  67. float pi = 3.141592654;
  68. int randomcols[] = {128, 0, 255};
  69. int strpos;
  70. int vispos;
  71. int sbouncephase = 1;
  72. int sbouncepos;
  73. int Bouncepos;
  74. int Bouncephase = 1;
  75. CRGB leds[NUM_LEDS];
  76. int pulsepos;
  77. int pulsephase = 1;
  78. CRGB raindrops[30];
  79. int rainspeeds[30];
  80. int rainposs[30];
  81. int rainloc[30];
  82. int sparklephase[30];
  83. int shiftspeeds[61];
  84. int shiftposs[61];
  85. int shiftloc[61];
  86. int shiftphase[61];
  87. CRGB shiftcol1[61];
  88. CRGB shiftcol2[61];
  89.  
  90. int Variation = 3;
  91. int mode_Solid = 0;
  92. int mode_RainbowFade = 0;
  93. int mode_RainbowWave = 1;
  94. int mode_IndivJump = 0;
  95. int mode_AllJump = 0;
  96. int mode_Strobe = 0;
  97. int mode_Marquee = 0;
  98. int mode_Segment = 0;
  99. int mode_Visor = 0;
  100. int mode_Bounce = 0;
  101. int mode_Ripple = 0;
  102. int mode_Pulse = 0;
  103. int mode_Rain = 0;
  104. int mode_Special = 0;
  105. int mode_Sparkle = 0;
  106. int mode_Shift = 0;
  107.  
  108.  
  109. void setup() {
  110. irrecv.enableIRIn(); // Start the receiver
  111. Serial.begin(9600);
  112. // put your setup code here, to run once:
  113. FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  114. FastLED.clear();
  115. FastLED.show();
  116. FastLED.setBrightness(255);
  117. Serial.print("now running IR Pin ");
  118. Serial.println(kRecvPin);
  119. FastLED.setMaxPowerInVoltsAndMilliamps(5, 2000);
  120. }
  121.  
  122. void loop() {
  123. // put your main code here, to run repeatedly:
  124. if (mode_Solid)
  125. do_Static();
  126. if (mode_RainbowFade) {
  127. if (Variation == 0)
  128. do_Rainbow_Fade();
  129. if (Variation == 1)
  130. do_MC_Fade();
  131. if (Variation >= 2)
  132. Variation = 0;
  133. }
  134. if (mode_RainbowWave) {
  135. if (Variation == 0)
  136. do_Spiral_Rainbow_Wave_1();
  137. if (Variation == 1)
  138. do_Spiral_Rainbow_Wave_2();
  139. if (Variation == 2)
  140. do_Spiral_Rainbow_Wave_3();
  141. if (Variation == 3)
  142. do_Spiral_MC_Wave_1();
  143. if (Variation == 4)
  144. do_Spiral_MC_Wave_2();
  145. if (Variation == 5)
  146. do_Spiral_MC_Wave_3();
  147. if (Variation == 6)
  148. do_Linear_Rainbow_Gradient_1();
  149. if (Variation == 7)
  150. do_Linear_Rainbow_Gradient_2();
  151. if (Variation == 8)
  152. do_Linear_Rainbow_Gradient_3();
  153. if (Variation == 9)
  154. do_Linear_MC_Gradient_1();
  155. if (Variation == 10)
  156. do_Linear_MC_Gradient_2();
  157. if (Variation == 11)
  158. do_Linear_MC_Gradient_3();
  159. if (Variation >= 12)
  160. Variation = 0;
  161. }
  162.  
  163. if (mode_IndivJump) {
  164. if (Variation == 0)
  165. do_Indiv_Jump_Rainbow();
  166. if (Variation == 1)
  167. do_Indiv_Jump_MC();
  168. if (Variation >= 2)
  169. Variation = 0;
  170. }
  171.  
  172. if (mode_AllJump)
  173. do_All_Jump_Rainbow();
  174. if (mode_Strobe) {
  175. if (Variation == 0)
  176. do_Strobe_Static();
  177. if (Variation == 1)
  178. do_Strobe_MC();
  179. if (Variation == 2)
  180. do_Strobe_Rainbow();
  181. if (Variation >= 3)
  182. Variation = 0;
  183. }
  184. if (mode_Marquee) {
  185. if (Variation == 0)
  186. do_Marquee_MC();
  187. if (Variation == 1)
  188. do_Marquee_Rainbow();
  189. if (Variation == 2)
  190. do_Marquee_Static();
  191. if (Variation >= 3)
  192. Variation = 0;
  193. }
  194. if (mode_Segment) {
  195. if (Variation == 0)
  196. do_Segment_Rainbow();
  197. if (Variation == 1)
  198. do_Segment_MC();
  199. if (Variation == 2)
  200. do_Segment_Static();
  201. if (Variation >= 3)
  202. Variation = 0;
  203. }
  204. if (mode_Visor) {
  205. if (Variation == 0)
  206. do_Visor_MC();
  207. if (Variation == 1)
  208. do_Visor_Rainbow();
  209. if (Variation == 2)
  210. do_Visor_Static();
  211. if (Variation >= 3)
  212. Variation = 0;
  213. }
  214. if (mode_Bounce) {
  215. if (Variation == 0)
  216. do_Bounce_Linear_MC();
  217. if (Variation == 1)
  218. do_Bounce_Spiral_Static();
  219. if (Variation == 2)
  220. do_Bounce_Spiral_Rainbow();
  221. if (Variation == 3)
  222. do_Bounce_Spiral_MC();
  223. if (Variation == 4)
  224. do_Bounce_Linear_Rainbow();
  225. if (Variation == 5)
  226. do_Bounce_Linear_Static();
  227. if (Variation >= 6)
  228. Variation = 0;
  229. }
  230. if (mode_Ripple) {
  231. if (Variation == 0)
  232. do_Ripple_Rainbow();
  233. if (Variation == 1)
  234. do_Ripple_MC();
  235. if (Variation == 2)
  236. do_Ripple_Static();
  237. if (Variation >= 3)
  238. Variation = 0;
  239. }
  240.  
  241. if (mode_Pulse) {
  242. if (Variation == 0)
  243. do_Pulse_Rainbow();
  244. if (Variation == 1)
  245. do_Pulse_MC();
  246. if (Variation == 2)
  247. do_Pulse_Static();
  248. if (Variation >= 3)
  249. Variation = 0;
  250.  
  251. }
  252. if (mode_Rain) {
  253. if (Variation == 0)
  254. do_Rain_Rainbow();
  255. if (Variation == 1)
  256. do_Rain_MC();
  257. if (Variation == 2)
  258. do_Rain_Static();
  259. if (Variation >= 3)
  260. Variation = 0;
  261. }
  262. if (mode_Special) {
  263. if (Variation == 0)
  264. do_Special_Xmas();
  265. if (Variation == 1)
  266. do_Special_Special();
  267. if (Variation >= 2)
  268. Variation = 0;
  269. }
  270. if (mode_Sparkle)
  271. do_Sparkle();
  272. if (mode_Shift) {
  273. if (Variation == 1)
  274. do_Shift_MC();
  275. if (Variation == 0)
  276. do_Shift_Rainbow();
  277. if (Variation >= 2)
  278. Variation = 0;
  279. }
  280.  
  281. if (irrecv.decode(&results)) {
  282. // print() & println() can't handle printing long longs. (uint64_t)
  283. int code = results.value;
  284. Serial.print(code);
  285. Serial.println("");
  286. if (code == 16726725) {
  287. Serial.println("BRIGHT UP");
  288. brightness += 20;
  289. if (brightness > 100)
  290. brightness = 100;
  291. if (brightness < 0)
  292. brightness = 0;
  293. FastLED.setBrightness(map(brightness, 0, 100, 0, 255));
  294. }
  295. if (code == 16759365) {
  296. Serial.println("BRIGHT DOWN");
  297. if (brightness > 20)
  298. brightness -= 20;
  299. else
  300. brightness = 5;
  301. if (brightness > 100)
  302. brightness = 100;
  303. if (brightness < 1)
  304. brightness = 5;
  305. Serial.println(brightness);
  306. FastLED.setBrightness(map(brightness, 0, 100, 0, 255));
  307. }
  308.  
  309.  
  310. if (code == 16771095) {
  311. Serial.println("SPEED UP");
  312. anispeed += 10;
  313. if (anispeed > 100)
  314. anispeed = 100;
  315. if (anispeed < 0)
  316. anispeed = 0;
  317. }
  318. if (code == 16762935) {
  319. Serial.println("SPEED DOWN");
  320. anispeed -= 10;
  321. if (anispeed > 100)
  322. anispeed = 100;
  323. if (anispeed < 0)
  324. anispeed = 0;
  325. }
  326.  
  327. if (code == 16745085) {
  328. Serial.println("VARITATION ++");
  329. soft_Zero();
  330. Variation++;
  331. }
  332. if (code == 16712445) {
  333. Serial.println("OFF");
  334. all_Zero();
  335. FastLED.clear();
  336. FastLED.show();
  337. }
  338. if (code == 16751205) {
  339. Serial.println("COLOUR ");
  340. all_Zero();
  341. mode_Solid = 1;
  342. static_r = 0;
  343. static_g = 255;
  344. static_b = 0;
  345.  
  346. }
  347.  
  348. if (code == 16718565) {
  349. Serial.println("COLOUR ");
  350. all_Zero();
  351. mode_Solid = 1;
  352. static_r = 255;
  353. static_g = 0;
  354. static_b = 0;
  355.  
  356. }
  357. if (code == 16753245) {
  358. Serial.println("COLOUR ");
  359. all_Zero();
  360. mode_Solid = 1;
  361. static_r = 0;
  362. static_g = 0;
  363. static_b = 255;
  364.  
  365. }
  366. if (code == 16720605) {
  367. Serial.println("COLOUR ");
  368. all_Zero();
  369. mode_Solid = 1;
  370. static_r = 255;
  371. static_g = 255;
  372. static_b = 255;
  373.  
  374. }
  375. if (code == 16722645) {
  376. Serial.println("COLOUR ");
  377. all_Zero();
  378. mode_Solid = 1;
  379. static_r = 200;
  380. static_g = 10;
  381. static_b = 0;
  382.  
  383. }
  384.  
  385. if (code == 16718055) {
  386. Serial.println("COLOUR ");
  387. all_Zero();
  388. mode_Solid = 1;
  389. static_r = 255;
  390. static_g = 200;
  391. static_b = 0;
  392.  
  393. }
  394. if (code == 16714485) {
  395. Serial.println("COLOUR ");
  396. all_Zero();
  397. mode_Solid = 1;
  398. static_r = 255;
  399. static_g = 30;
  400. static_b = 0;
  401.  
  402. }
  403. if (code == 16726215) {
  404. Serial.println("COLOUR ");
  405. all_Zero();
  406. mode_Solid = 1;
  407. static_r = 255;
  408. static_g = 100;
  409. static_b = 0;
  410.  
  411. }
  412.  
  413.  
  414. if (code == 16755285) {
  415. Serial.println("COLOUR ");
  416. all_Zero();
  417. mode_Solid = 1;
  418. static_r = 10;
  419. static_g = 255;
  420. static_b = 20;
  421.  
  422. }
  423.  
  424. if (code == 16747125) {
  425. Serial.println("COLOUR ");
  426. all_Zero();
  427. mode_Solid = 1;
  428. static_r = 0;
  429. static_g = 255;
  430. static_b = 100;
  431.  
  432. }
  433. if (code == 16758855) {
  434. Serial.println("COLOUR ");
  435. all_Zero();
  436. mode_Solid = 1;
  437. static_r = 0;
  438. static_g = 80;
  439. static_b = 30;
  440.  
  441. }
  442. if (code == 16750695) {
  443. Serial.println("COLOUR ");
  444. all_Zero();
  445. mode_Solid = 1;
  446. static_r = 0;
  447. static_g = 20;
  448. static_b = 2000;
  449.  
  450. }
  451.  
  452.  
  453. if (code == 16749165) {
  454. Serial.println("COLOUR ");
  455. all_Zero();
  456. mode_Solid = 1;
  457. static_r = 0;
  458. static_g = 20;
  459. static_b = 255;
  460.  
  461. }
  462.  
  463. if (code == 16757325) {
  464. Serial.println("COLOUR ");
  465. all_Zero();
  466. mode_Solid = 1;
  467. static_r = 3;
  468. static_g = 0;
  469. static_b = 40;
  470.  
  471. }
  472. if (code == 16742535) {
  473. Serial.println("COLOUR ");
  474. all_Zero();
  475. mode_Solid = 1;
  476. static_r = 200;
  477. static_g = 0;
  478. static_b = 100;
  479.  
  480. }
  481. if (code == 16734375) {
  482. Serial.println("COLOUR ");
  483. all_Zero();
  484. mode_Solid = 1;
  485. static_r = 255;
  486. static_g = 0;
  487. static_b = 40;
  488.  
  489. }
  490.  
  491.  
  492. if (code == 16716525) {
  493. Serial.println("COLOUR ");
  494. all_Zero();
  495. mode_Solid = 1;
  496. static_r = 255;
  497. static_g = 100;
  498. static_b = 80;
  499.  
  500. }
  501.  
  502. if (code == 16724685) {
  503. Serial.println("COLOUR ");
  504. all_Zero();
  505. mode_Solid = 1;
  506. static_r = 255;
  507. static_g = 70;
  508. static_b = 40;
  509.  
  510. }
  511. if (code == 16767015) {
  512. Serial.println("COLOUR ");
  513. all_Zero();
  514. mode_Solid = 1;
  515. static_r = 230;
  516. static_g = 245;
  517. static_b = 255;
  518.  
  519. }
  520. if (code == 16775175) {
  521. Serial.println("COLOUR ");
  522. all_Zero();
  523. mode_Solid = 1;
  524. static_r = 255;
  525. static_g = 200;
  526. static_b = 255;
  527.  
  528. }
  529.  
  530.  
  531. if (code == 16769055) {
  532. Serial.println("Fade ");
  533. all_Zero();
  534. mode_RainbowFade = 1;
  535. }
  536. if (code == 16736415) {
  537. Serial.println("Wave ");
  538. all_Zero();
  539. mode_RainbowWave = 1;
  540. }
  541. if (code == 16752735) {
  542. Serial.println("Indiv Jump ");
  543. all_Zero();
  544. mode_IndivJump = 1;
  545. }
  546. if (code == 16720095) {
  547. Serial.println("All Jump ");
  548. all_Zero();
  549. mode_AllJump = 1;
  550. }
  551.  
  552. if (code == 16764975) {
  553. Serial.println("Strobe ");
  554. all_Zero();
  555. mode_Strobe = 1;
  556. }
  557. if (code == 16732335) {
  558. Serial.println("Marquee ");
  559. all_Zero();
  560. mode_Marquee = 1;
  561. }
  562. if (code == 16748655) {
  563. Serial.println("Segment ");
  564. all_Zero();
  565. mode_Segment = 1;
  566. }
  567. if (code == 16716015) {
  568. Serial.println("Visor ");
  569. all_Zero();
  570. mode_Visor = 1;
  571. }
  572.  
  573. if (code == 16773135) {
  574. Serial.println("Special ");
  575. all_Zero();
  576. mode_Special = 1;
  577. }
  578. if (code == 16740495) {
  579. Serial.println("Bounce ");
  580. all_Zero();
  581. mode_Bounce = 1;
  582. }
  583. if (code == 16756815) {
  584. Serial.println("Ripple ");
  585. all_Zero();
  586. mode_Ripple = 1;
  587. }
  588. if (code == 16724175) {
  589. Serial.println("Pulse ");
  590. all_Zero();
  591. mode_Pulse = 1;
  592. }
  593.  
  594.  
  595. if (code == 16730295) {
  596. Serial.println("Rain ");
  597. all_Zero();
  598. mode_Rain = 1;
  599. }
  600. if (code == 16746615) {
  601. Serial.println("Sparkle ");
  602. all_Zero();
  603. mode_Sparkle = 1;
  604. }
  605. if (code == 16713975) {
  606. Serial.println("Shift ");
  607. all_Zero();
  608. mode_Shift = 1;
  609. }
  610.  
  611. irrecv.resume(); // Receive the next value
  612.  
  613. }
  614. }
  615. void soft_Zero() {
  616.  
  617. for (int x = 0; x < 61; x++)
  618. {
  619. shiftspeeds[x] = 0;
  620. shiftposs[x] = 0;
  621. shiftloc[x] = 0;
  622. shiftphase[x] = 0;
  623. shiftcol1[x] = CRGB(0, 0, 0);
  624. shiftcol2[x] = CRGB(0, 0, 0);
  625. }
  626. for (int x = 0; x < 30; x++)
  627. {
  628. rainposs[x] = 0;
  629. raindrops[x] = CRGB(0, 0, 0);
  630. rainspeeds[x] = 0;
  631. rainloc[x] = 0;
  632. }
  633. FastLED.clear();
  634. }
  635. void all_Zero() {
  636. Variation = 0;
  637. mode_Solid = 0;
  638. mode_RainbowFade = 0;
  639. mode_RainbowWave = 0;
  640. mode_IndivJump = 0;
  641. mode_AllJump = 0;
  642. mode_Strobe = 0;
  643. mode_Marquee = 0;
  644. mode_Segment = 0;
  645. mode_Visor = 0;
  646. mode_Bounce = 0;
  647. mode_Ripple = 0;
  648. mode_Pulse = 0;
  649. mode_Rain = 0;
  650. mode_Special = 0;
  651. mode_Sparkle = 0;
  652. mode_Shift = 0;
  653. soft_Zero();
  654. }
  655. void do_Shift_Rainbow() {
  656.  
  657. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40map(anispeed, 0, 100, 40, 10)
  658. mil = millis();
  659.  
  660. //fill_solid(leds, 61, CRGB(static_r*lowm,static_g*lowm,static_b*lowm));
  661.  
  662. //generate
  663. for ( int i = 0; i < 61; i++) {
  664.  
  665. if (shiftposs[i] <= 0) {
  666.  
  667. if (shiftphase[i] == 0) {
  668. shiftcol1[i] = CRGB(randomcols[random(3)], randomcols[random(3)], randomcols[random(3)]);
  669.  
  670. }
  671. else {
  672. shiftcol1[i] = shiftcol2[i];
  673. }
  674. shiftcol2[i] = CRGB(randomcols[random(3)], randomcols[random(3)], randomcols[random(3)]);
  675. shiftposs[i] = 1;
  676. shiftphase[i] = 1;
  677. shiftspeeds[i] = random(1, 5);
  678.  
  679.  
  680. //Serial.println("Good");
  681.  
  682. }
  683. else {
  684. if (shiftphase[i] == 1)
  685. shiftposs[i] += shiftspeeds[i];
  686.  
  687. if (shiftposs[i] >= 100) {
  688. shiftposs[i] = 0;
  689. shiftphase[i] = 1;
  690.  
  691.  
  692. shiftcol1[i] = shiftcol2[i];
  693.  
  694. shiftcol2[i] = CRGB(randomcols[random(3)], randomcols[random(3)], randomcols[random(3)]);
  695. shiftposs[i] = 1;
  696. shiftphase[i] = 1;
  697. shiftspeeds[i] = random(1, 2);
  698.  
  699.  
  700.  
  701.  
  702. }
  703. // if (shiftposs[i] <= 0) {
  704. // shiftposs[i] = 2;
  705. // shiftphase[i] = 1;
  706. // }
  707. fade(i, shiftcol1[i], shiftcol2[i], shiftposs[i]);
  708.  
  709.  
  710. }
  711.  
  712. }
  713.  
  714. FastLED.show();
  715. }
  716. }
  717.  
  718. void do_Shift_MC() {
  719.  
  720. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40map(anispeed, 0, 100, 40, 10)
  721. mil = millis();
  722. //fill_solid(leds, 61, CRGB(static_r*lowm,static_g*lowm,static_b*lowm));
  723.  
  724. //generate
  725. for ( int i = 0; i < 61; i++) {
  726.  
  727. if (shiftposs[i] <= 0) {
  728.  
  729.  
  730. shiftposs[i] = random(2, 100);
  731. shiftphase[i] = random(1, 3);
  732. shiftspeeds[i] = random(1, 5);
  733. shiftloc[i] = random(61);
  734. int count = 0;
  735. // Serial.println(i);
  736. while (count != 1) {
  737. count = 0;
  738. for ( int t = 0; t < 61; t++) {
  739. if (shiftloc[i] == shiftloc[t])
  740. count++;
  741. }
  742. if (count != 1) {
  743. shiftloc[i] = random(61);
  744. // Serial.println("BAD");
  745. }
  746.  
  747. }
  748. //Serial.println("Good");
  749.  
  750. }
  751. else {
  752. if (shiftphase[i] == 1)
  753. shiftposs[i] += shiftspeeds[i];
  754. else if (shiftphase[i] == 2)
  755. shiftposs[i] -= shiftspeeds[i];
  756. if (shiftposs[i] >= 100) {
  757. shiftposs[i] = 98;
  758. shiftphase[i] = 2;
  759. }
  760. if (shiftposs[i] <= 0) {
  761. shiftposs[i] = 2;
  762. shiftphase[i] = 1;
  763. }
  764. fade(shiftloc[i], default_col_1, default_col_2, shiftposs[i]);
  765.  
  766.  
  767. }
  768.  
  769. }
  770.  
  771. FastLED.show();
  772. }
  773. }
  774.  
  775. void do_Sparkle() {
  776. float lowm = 0.3;
  777. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40
  778. mil = millis();
  779. fill_solid(leds, 61, CRGB(static_r * lowm, static_g * lowm, static_b * lowm));
  780.  
  781. //generate
  782. for ( int i = 0; i < 30; i++) {
  783.  
  784. if (rainposs[i] <= 0) {
  785.  
  786. raindrops[i] = CRGB(static_r, static_g, static_b);
  787.  
  788.  
  789. rainposs[i] = 1;
  790. sparklephase[i] = 1;
  791. rainspeeds[i] = random(1, 5);
  792. rainloc[i] = random(61);
  793. int count = 0;
  794. while (count != 1) {
  795. count = 0;
  796. for ( int t = 0; t < 30; t++) {
  797. if (rainloc[i] == rainloc[t])
  798. count++;
  799. }
  800. if (count != 1) {
  801. rainloc[i] = random(61);
  802. }
  803.  
  804. }
  805.  
  806. }
  807. else {
  808. if (sparklephase[i] == 1)
  809. rainposs[i] += rainspeeds[i];
  810. else if (sparklephase[i] == 2)
  811. rainposs[i] -= rainspeeds[i];
  812. if (rainposs[i] >= 100) {
  813. rainposs[i] = 99;
  814. sparklephase[i] = 2;
  815. }
  816. if (rainposs[i] <= 0) {
  817. rainposs[i] = 0;
  818. sparklephase[i] = 1;
  819. }
  820. fade(rainloc[i], CRGB(static_r * lowm, static_g * lowm, static_b * lowm), raindrops[i], rainposs[i]);
  821.  
  822.  
  823. }
  824. }
  825.  
  826. FastLED.show();
  827. }
  828. }
  829. void do_Special_Special() {
  830. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40
  831. mil = millis();
  832. fill_solid(leds, 61, CRGB(150, 1, 50));
  833. //generate
  834. for ( int i = 0; i < 30; i++) {
  835.  
  836. if (rainposs[i] <= 0) {
  837. if (random(2))
  838. raindrops[i] = CRGB::Red;
  839. else
  840. raindrops[i] = CRGB::Purple;
  841.  
  842. rainposs[i] = 1;
  843. sparklephase[i] = 1;
  844. rainspeeds[i] = random(1, 5);
  845. rainloc[i] = random(61);
  846. int count = 0;
  847. while (count != 1) {
  848. count = 0;
  849. for ( int t = 0; t < 30; t++) {
  850. if (rainloc[i] == rainloc[t])
  851. count++;
  852. }
  853. if (count != 1) {
  854. rainloc[i] = random(61);
  855. }
  856.  
  857. }
  858.  
  859. }
  860. else {
  861. if (sparklephase[i] == 1)
  862. rainposs[i] += rainspeeds[i];
  863. else if (sparklephase[i] == 2)
  864. rainposs[i] -= rainspeeds[i];
  865. if (rainposs[i] >= 100) {
  866. rainposs[i] = 99;
  867. sparklephase[i] = 2;
  868. }
  869. if (rainposs[i] <= 0) {
  870. rainposs[i] = 0;
  871. sparklephase[i] = 1;
  872. }
  873. fade(rainloc[i], CRGB(150, 1, 50), raindrops[i], rainposs[i]);
  874.  
  875.  
  876. }
  877. }
  878.  
  879. FastLED.show();
  880. }
  881. }
  882. void do_Special_Xmas() {
  883. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40
  884. mil = millis();
  885. fill_solid(leds, 61, CRGB::Red);
  886. //generate
  887. for ( int i = 0; i < 30; i++) {
  888.  
  889. if (rainposs[i] <= 0) {
  890. raindrops[i] = CRGB::Green;
  891. rainposs[i] = 1;
  892. sparklephase[i] = 1;
  893. rainspeeds[i] = random(1, 5);
  894. rainloc[i] = random(61);
  895. int count = 0;
  896. while (count != 1) {
  897. count = 0;
  898. for ( int t = 0; t < 30; t++) {
  899. if (rainloc[i] == rainloc[t])
  900. count++;
  901. }
  902. if (count != 1) {
  903. rainloc[i] = random(61);
  904. }
  905.  
  906. }
  907.  
  908. }
  909. else {
  910. if (sparklephase[i] == 1)
  911. rainposs[i] += rainspeeds[i];
  912. else if (sparklephase[i] == 2)
  913. rainposs[i] -= rainspeeds[i];
  914. if (rainposs[i] >= 100) {
  915. rainposs[i] = 99;
  916. sparklephase[i] = 2;
  917. }
  918. if (rainposs[i] <= 0) {
  919. rainposs[i] = 0;
  920. sparklephase[i] = 1;
  921. }
  922. fade(rainloc[i], CRGB::Red, raindrops[i], rainposs[i]);
  923.  
  924.  
  925. }
  926. }
  927.  
  928. FastLED.show();
  929. }
  930. }
  931.  
  932. void do_Rain_Rainbow() {
  933. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40
  934. mil = millis();
  935. FastLED.clear();
  936. //generate
  937. for ( int i = 0; i < 20; i++) {
  938.  
  939. if (rainposs[i] <= 0) {
  940. raindrops[i] = CRGB(randomcols[random(3)], randomcols[random(3)], randomcols[random(3)]);
  941. rainposs[i] = 100;
  942. rainspeeds[i] = random(1, 5);
  943. rainloc[i] = random(61);
  944. int count = 0;
  945. while (count != 1) {
  946. count = 0;
  947. for ( int t = 0; t < 20; t++) {
  948. if (rainloc[i] == rainloc[t])
  949. count++;
  950. }
  951. if (count != 1) {
  952. rainloc[i] = random(61);
  953. }
  954.  
  955. }
  956.  
  957. }
  958. else {
  959. rainposs[i] -= rainspeeds[i];
  960. if (rainposs[i] < 0)
  961. rainposs[i] = 0;
  962. fade(rainloc[i], CRGB::Black, raindrops[i], rainposs[i]);
  963.  
  964.  
  965. }
  966. }
  967.  
  968. FastLED.show();
  969. }
  970. }
  971. void do_Rain_MC() {
  972. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 10 slow 40
  973. mil = millis();
  974. FastLED.clear();
  975. //generate
  976. for ( int i = 0; i < 20; i++) {
  977.  
  978. if (rainposs[i] <= 0) {
  979. if (random(2))
  980. raindrops[i] = default_col_1;
  981. else
  982. raindrops[i] = default_col_2;
  983. rainposs[i] = 100;
  984. rainspeeds[i] = random(1, 5);
  985. rainloc[i] = random(61);
  986. int count = 0;
  987. while (count != 1) {
  988. count = 0;
  989. for ( int t = 0; t < 20; t++) {
  990. if (rainloc[i] == rainloc[t])
  991. count++;
  992. }
  993. if (count != 1) {
  994. rainloc[i] = random(61);
  995. }
  996.  
  997. }
  998.  
  999. }
  1000. else {
  1001. rainposs[i] -= rainspeeds[i];
  1002. if (rainposs[i] < 0)
  1003. rainposs[i] = 0;
  1004. fade(rainloc[i], CRGB::Black, raindrops[i], rainposs[i]);
  1005.  
  1006.  
  1007. }
  1008. }
  1009.  
  1010. FastLED.show();
  1011. }
  1012. }
  1013. void do_Rain_Static() {
  1014. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 10 slow 40
  1015. mil = millis();
  1016. FastLED.clear();
  1017. //generate
  1018. for ( int i = 0; i < 20; i++) {
  1019.  
  1020. if (rainposs[i] <= 0) {
  1021.  
  1022. raindrops[i] = CRGB(static_r, static_g, static_b);
  1023.  
  1024. rainposs[i] = 100;
  1025. rainspeeds[i] = random(1, 5);
  1026. rainloc[i] = random(61);
  1027. int count = 0;
  1028. while (count != 1) {
  1029. count = 0;
  1030. for ( int t = 0; t < 20; t++) {
  1031. if (rainloc[i] == rainloc[t])
  1032. count++;
  1033. }
  1034. if (count != 1) {
  1035. rainloc[i] = random(61);
  1036. }
  1037.  
  1038. }
  1039.  
  1040. }
  1041. else {
  1042. rainposs[i] -= rainspeeds[i];
  1043. if (rainposs[i] < 0)
  1044. rainposs[i] = 0;
  1045. fade(rainloc[i], CRGB::Black, raindrops[i], rainposs[i]);
  1046.  
  1047.  
  1048. }
  1049. }
  1050.  
  1051. FastLED.show();
  1052. }
  1053. }
  1054. void do_Pulse_MC() {
  1055. //Serial.println(pulsepos);
  1056. int pulsespeed = 2;
  1057. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40
  1058. mil = millis();
  1059. if (pulsepos >= 0)
  1060. FastLED.setBrightness(map(pulsepos, 0, 100, 0, 255));
  1061. else
  1062. FastLED.setBrightness(0);
  1063. if (pulsephase == 1) {
  1064. pulsepos += pulsespeed * 2;
  1065. if (pulsepos >= 100) {
  1066. pulsepos = 100;
  1067. pulsephase = 2;
  1068. }
  1069. }
  1070.  
  1071. if (pulsephase == 2) {
  1072. pulsepos -= pulsespeed;
  1073. if (pulsepos <= -30) {
  1074. pulsepos = -30;
  1075. pulsephase = 1;
  1076. }
  1077. }
  1078. colorIndex = startIndex;
  1079. for ( int i = 0; i < 1; i++) {
  1080. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1081.  
  1082.  
  1083. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  1084.  
  1085. colorIndex = colorIndex + 1; //how fast to advance through palette 3
  1086. }
  1087. colorIndex = startIndex;
  1088. for ( int i = 1; i < 7; i++) {
  1089. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1090.  
  1091.  
  1092. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  1093.  
  1094. colorIndex = colorIndex + 42; //how fast to advance through palette 3
  1095. }
  1096. for ( int i = 7; i < 19; i++) {
  1097. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1098.  
  1099.  
  1100. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  1101.  
  1102. colorIndex = colorIndex + 21; //how fast to advance through palette 3
  1103. }
  1104.  
  1105. for ( int i = 19; i < 37; i++) {
  1106. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1107.  
  1108.  
  1109. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  1110.  
  1111. colorIndex = colorIndex + 14; //how fast to advance through palette 3
  1112. }
  1113. colorIndex = startIndex;
  1114. for ( int i = 37; i < 61; i++) {
  1115. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1116.  
  1117.  
  1118. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  1119.  
  1120. colorIndex = colorIndex + 11; //how fast to advance through palette 3
  1121. }
  1122. FastLED.show();
  1123. FastLED.setBrightness(brightness);
  1124.  
  1125. }
  1126. }
  1127. void do_Pulse_Static() {
  1128. // Serial.println(pulsepos);
  1129. int pulsespeed = 2;
  1130. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40
  1131. mil = millis();
  1132. if (pulsepos >= 0)
  1133. FastLED.setBrightness(map(pulsepos, 0, 100, 0, 255));
  1134. else
  1135. FastLED.setBrightness(0);
  1136. if (pulsephase == 1) {
  1137. pulsepos += pulsespeed * 2;
  1138. if (pulsepos >= 100) {
  1139. pulsepos = 100;
  1140. pulsephase = 2;
  1141. }
  1142. }
  1143.  
  1144. if (pulsephase == 2) {
  1145. pulsepos -= pulsespeed;
  1146. if (pulsepos <= -30) {
  1147. pulsepos = -30;
  1148. pulsephase = 1;
  1149. }
  1150. }
  1151. fill_solid(leds, 61, CRGB(static_r, static_g, static_b));
  1152. FastLED.show();
  1153. FastLED.setBrightness(brightness);
  1154.  
  1155. }
  1156. }
  1157. void do_Pulse_Rainbow() {
  1158. // Serial.println(pulsepos);
  1159. int pulsespeed = 2;
  1160. if (millis() - mil >= map(anispeed, 0, 100, 40, 10)) { // speedy 20 slow 40
  1161. mil = millis();
  1162. if (pulsepos >= 0)
  1163. FastLED.setBrightness(map(pulsepos, 0, 100, 0, 255));
  1164. else
  1165. FastLED.setBrightness(0);
  1166. if (pulsephase == 1) {
  1167. pulsepos += pulsespeed * 2;
  1168. if (pulsepos >= 100) {
  1169. pulsepos = 100;
  1170. pulsephase = 2;
  1171. }
  1172. }
  1173.  
  1174. if (pulsephase == 2) {
  1175. pulsepos -= pulsespeed;
  1176. if (pulsepos <= -30) {
  1177. pulsepos = -30;
  1178. pulsephase = 1;
  1179. }
  1180. }
  1181. colorIndex = startIndex;
  1182. for ( int i = 0; i < 1; i++) {
  1183. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1184.  
  1185.  
  1186. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  1187.  
  1188. colorIndex = colorIndex + 1; //how fast to advance through palette 3
  1189. }
  1190. colorIndex = startIndex;
  1191. for ( int i = 1; i < 7; i++) {
  1192. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1193.  
  1194.  
  1195. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  1196.  
  1197. colorIndex = colorIndex + 42; //how fast to advance through palette 3
  1198. }
  1199. for ( int i = 7; i < 19; i++) {
  1200. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1201.  
  1202.  
  1203. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  1204.  
  1205. colorIndex = colorIndex + 21; //how fast to advance through palette 3
  1206. }
  1207.  
  1208. for ( int i = 19; i < 37; i++) {
  1209. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1210.  
  1211.  
  1212. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  1213.  
  1214. colorIndex = colorIndex + 14; //how fast to advance through palette 3
  1215. }
  1216. colorIndex = startIndex;
  1217. for ( int i = 37; i < 61; i++) {
  1218. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  1219.  
  1220.  
  1221. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  1222.  
  1223. colorIndex = colorIndex + 11; //how fast to advance through palette 3
  1224. }
  1225. FastLED.show();
  1226. FastLED.setBrightness(brightness);
  1227.  
  1228. }
  1229. }
  1230.  
  1231. void do_Static() {
  1232. if (millis() - mil >= 500) {// speedy
  1233. mil = millis();
  1234. fill_solid(leds, 61, CRGB(static_r, static_g, static_b));
  1235. FastLED.show();
  1236. }
  1237. }
  1238. void do_Bounce_Spiral_Static() {
  1239. if (millis() - mil >= map(anispeed, 0, 100, 500, 80)) { // speedy
  1240. mil = millis();
  1241.  
  1242. if (sbouncephase == 1) {
  1243. sbouncepos++;
  1244. if (sbouncepos > 5) {
  1245. sbouncepos = 5;
  1246. sbouncephase = 2;
  1247. }
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254. }
  1255.  
  1256. if (sbouncephase == 2) {
  1257. sbouncepos--;
  1258. if (sbouncepos <= 0) {
  1259. sbouncepos = 0;
  1260. sbouncephase = 1;
  1261. }
  1262. }
  1263. if (sbouncepos == 5)
  1264. leds[0] = CRGB(static_r, static_g, static_b);
  1265. else
  1266. leds[0] = CRGB::Black;
  1267. for ( int i = 1; i < 7; i++) {
  1268.  
  1269. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1270. if (sbouncepos >= 4)
  1271. leds[i] = CRGB(static_r, static_g, static_b);
  1272. else
  1273. leds[i] = CRGB::Black;
  1274. }
  1275. for ( int i = 7; i < 19; i++) {
  1276.  
  1277. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1278. if (sbouncepos >= 3)
  1279. leds[i] = CRGB(static_r, static_g, static_b);
  1280. else
  1281. leds[i] = CRGB::Black;
  1282. }
  1283.  
  1284.  
  1285. for ( int i = 19; i < 37; i++) {
  1286.  
  1287. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1288. if (sbouncepos >= 2)
  1289. leds[i] = CRGB(static_r, static_g, static_b);
  1290. else
  1291. leds[i] = CRGB::Black;
  1292. }
  1293. for ( int i = 37; i < 61; i++) {
  1294.  
  1295. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1296. if (sbouncepos >= 1)
  1297. leds[i] = CRGB(static_r, static_g, static_b);
  1298. else
  1299. leds[i] = CRGB::Black;
  1300. }
  1301. FastLED.show();
  1302.  
  1303. }
  1304. }
  1305. void do_Bounce_Spiral_MC() {
  1306. if (millis() - mil >= map(anispeed, 0, 100, 500, 80)) { // speedy
  1307. mil = millis();
  1308.  
  1309. if (sbouncephase == 1) {
  1310. sbouncepos++;
  1311. if (sbouncepos > 5) {
  1312. sbouncepos = 5;
  1313. sbouncephase = 2;
  1314. }
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321. }
  1322.  
  1323. if (sbouncephase == 2) {
  1324. sbouncepos--;
  1325. if (sbouncepos <= 0) {
  1326. sbouncepos = 0;
  1327. sbouncephase = 1;
  1328. }
  1329. }
  1330. if (sbouncepos == 5)
  1331. fade(0, default_col_1, default_col_2, 50 );
  1332. else
  1333. leds[0] = CRGB::Black;
  1334. for ( int i = 1; i < 7; i++) {
  1335.  
  1336. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1337. if (sbouncepos >= 4)
  1338. fade(i, default_col_1, default_col_2, val );
  1339. else
  1340. leds[i] = CRGB::Black;
  1341. }
  1342. for ( int i = 7; i < 19; i++) {
  1343.  
  1344. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1345. if (sbouncepos >= 3)
  1346. fade(i, default_col_1, default_col_2, val );
  1347. else
  1348. leds[i] = CRGB::Black;
  1349. }
  1350.  
  1351.  
  1352. for ( int i = 19; i < 37; i++) {
  1353.  
  1354. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1355. if (sbouncepos >= 2)
  1356. fade(i, default_col_1, default_col_2, val );
  1357. else
  1358. leds[i] = CRGB::Black;
  1359. }
  1360. for ( int i = 37; i < 61; i++) {
  1361.  
  1362. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1363. if (sbouncepos >= 1)
  1364. fade(i, default_col_1, default_col_2, val );
  1365. else
  1366. leds[i] = CRGB::Black;
  1367. }
  1368. FastLED.show();
  1369.  
  1370. }
  1371. }
  1372.  
  1373. void do_Bounce_Spiral_Rainbow() {
  1374. if (millis() - mil >= map(anispeed, 0, 100, 500, 80)) { // speedy
  1375. mil = millis();
  1376.  
  1377. if (sbouncephase == 1) {
  1378. sbouncepos++;
  1379. if (sbouncepos > 5) {
  1380. sbouncepos = 5;
  1381. sbouncephase = 2;
  1382. }
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389. }
  1390.  
  1391. if (sbouncephase == 2) {
  1392. sbouncepos--;
  1393. if (sbouncepos <= 0) {
  1394. sbouncepos = 0;
  1395. sbouncephase = 1;
  1396. }
  1397. }
  1398. if (sbouncepos == 5)
  1399. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  1400. else
  1401. leds[0] = CRGB::Black;
  1402. for ( int i = 1; i < 7; i++) {
  1403.  
  1404. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1405. if (sbouncepos >= 4)
  1406. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1407. else
  1408. leds[i] = CRGB::Black;
  1409. }
  1410. for ( int i = 7; i < 19; i++) {
  1411.  
  1412. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1413. if (sbouncepos >= 3)
  1414. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1415. else
  1416. leds[i] = CRGB::Black;
  1417. }
  1418.  
  1419.  
  1420. for ( int i = 19; i < 37; i++) {
  1421.  
  1422. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1423. if (sbouncepos >= 2)
  1424. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1425. else
  1426. leds[i] = CRGB::Black;
  1427. }
  1428. for ( int i = 37; i < 61; i++) {
  1429.  
  1430. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1431. if (sbouncepos >= 1)
  1432. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1433. else
  1434. leds[i] = CRGB::Black;
  1435. }
  1436. FastLED.show();
  1437.  
  1438. }
  1439. }
  1440.  
  1441. void do_Ripple_Rainbow() {
  1442. if (millis() - mil >= map(anispeed, 0, 100, 500, 80)) { // speedy
  1443. mil = millis();
  1444.  
  1445. if (sbouncephase == 1) {
  1446. sbouncepos++;
  1447. if (sbouncepos > 5) {
  1448. sbouncepos = 5;
  1449. sbouncephase = 2;
  1450. }
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457. }
  1458.  
  1459. if (sbouncephase == 2) {
  1460. sbouncepos--;
  1461. if (sbouncepos <= 1) {
  1462. sbouncepos = 1;
  1463. sbouncephase = 1;
  1464. }
  1465. }
  1466. if (sbouncepos == 5)
  1467. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  1468. else
  1469. leds[0] = CRGB::Black;
  1470. for ( int i = 1; i < 7; i++) {
  1471.  
  1472. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1473. if (sbouncepos == 4)
  1474. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1475. else
  1476. leds[i] = CRGB::Black;
  1477. }
  1478. for ( int i = 7; i < 19; i++) {
  1479.  
  1480. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1481. if (sbouncepos == 3)
  1482. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1483. else
  1484. leds[i] = CRGB::Black;
  1485. }
  1486.  
  1487.  
  1488. for ( int i = 19; i < 37; i++) {
  1489.  
  1490. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1491. if (sbouncepos == 2)
  1492. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1493. else
  1494. leds[i] = CRGB::Black;
  1495. }
  1496. for ( int i = 37; i < 61; i++) {
  1497.  
  1498. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1499. if (sbouncepos == 1)
  1500. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  1501. else
  1502. leds[i] = CRGB::Black;
  1503. }
  1504. FastLED.show();
  1505.  
  1506. }
  1507. }
  1508. void do_Ripple_MC() {
  1509. if (millis() - mil >= map(anispeed, 0, 100, 500, 80)) { // speedy
  1510. mil = millis();
  1511.  
  1512. if (sbouncephase == 1) {
  1513. sbouncepos++;
  1514. if (sbouncepos > 5) {
  1515. sbouncepos = 5;
  1516. sbouncephase = 2;
  1517. }
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524. }
  1525.  
  1526. if (sbouncephase == 2) {
  1527. sbouncepos--;
  1528. if (sbouncepos <= 1) {
  1529. sbouncepos = 1;
  1530. sbouncephase = 1;
  1531. }
  1532. }
  1533. if (sbouncepos == 5)
  1534. fade(0, default_col_1, default_col_2, 50 );
  1535. else
  1536. leds[0] = CRGB::Black;
  1537. for ( int i = 1; i < 7; i++) {
  1538.  
  1539. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1540. if (sbouncepos == 4)
  1541. fade(i, default_col_1, default_col_2, val );
  1542. else
  1543. leds[i] = CRGB::Black;
  1544. }
  1545. for ( int i = 7; i < 19; i++) {
  1546.  
  1547. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1548. if (sbouncepos == 3)
  1549. fade(i, default_col_1, default_col_2, val );
  1550. else
  1551. leds[i] = CRGB::Black;
  1552. }
  1553.  
  1554.  
  1555. for ( int i = 19; i < 37; i++) {
  1556.  
  1557. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1558. if (sbouncepos == 2)
  1559. fade(i, default_col_1, default_col_2, val );
  1560. else
  1561. leds[i] = CRGB::Black;
  1562. }
  1563. for ( int i = 37; i < 61; i++) {
  1564.  
  1565. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) ;
  1566. if (sbouncepos == 1)
  1567. fade(i, default_col_1, default_col_2, val );
  1568. else
  1569. leds[i] = CRGB::Black;
  1570. }
  1571. FastLED.show();
  1572.  
  1573. }
  1574. }
  1575. void do_Ripple_Static() {
  1576. if (millis() - mil >= map(anispeed, 0, 100, 500, 80)) { // speedy
  1577. mil = millis();
  1578.  
  1579. if (sbouncephase == 1) {
  1580. sbouncepos++;
  1581. if (sbouncepos > 5) {
  1582. sbouncepos = 5;
  1583. sbouncephase = 2;
  1584. }
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591. }
  1592.  
  1593. if (sbouncephase == 2) {
  1594. sbouncepos--;
  1595. if (sbouncepos <= 1) {
  1596. sbouncepos = 1;
  1597. sbouncephase = 1;
  1598. }
  1599. }
  1600. if (sbouncepos == 5)
  1601. leds[0] = CRGB(static_r, static_g, static_b);
  1602. else
  1603. leds[0] = CRGB::Black;
  1604. for ( int i = 1; i < 7; i++) {
  1605.  
  1606. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1607. if (sbouncepos == 4)
  1608. leds[i] = CRGB(static_r, static_g, static_b);
  1609. else
  1610. leds[i] = CRGB::Black;
  1611. }
  1612. for ( int i = 7; i < 19; i++) {
  1613.  
  1614. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1615. if (sbouncepos == 3)
  1616. leds[i] = CRGB(static_r, static_g, static_b);
  1617. else
  1618. leds[i] = CRGB::Black;
  1619. }
  1620.  
  1621.  
  1622. for ( int i = 19; i < 37; i++) {
  1623.  
  1624. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1625. if (sbouncepos == 2)
  1626. leds[i] = CRGB(static_r, static_g, static_b);
  1627. else
  1628. leds[i] = CRGB::Black;
  1629. }
  1630. for ( int i = 37; i < 61; i++) {
  1631.  
  1632. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  1633. if (sbouncepos == 1)
  1634. leds[i] = CRGB(static_r, static_g, static_b);
  1635. else
  1636. leds[i] = CRGB::Black;
  1637. }
  1638. FastLED.show();
  1639.  
  1640. }
  1641. }
  1642. void do_Bounce_Linear_MC() {
  1643. int Bouncespeed = 15;
  1644. if (millis() - mil >= map(anispeed, 0, 100, 120, 30)) { // speedy
  1645. mil = millis();
  1646.  
  1647.  
  1648.  
  1649. if (Bouncephase == 1) {
  1650. Bouncepos += Bouncespeed;
  1651. if (Bouncepos >= 120) {
  1652. Bouncepos = 100;
  1653. Bouncephase = 2;
  1654. }
  1655. if (50 <= Bouncepos)
  1656. fade(0, default_col_1, default_col_2, 50 );
  1657. else
  1658. leds[0] = CRGB::Black;
  1659. for ( int i = 1; i < 7; i++) {
  1660.  
  1661. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1662. if (val <= Bouncepos)
  1663. fade(i, default_col_1, default_col_2, val );
  1664. else
  1665. leds[i] = CRGB::Black;
  1666. }
  1667. for ( int i = 7; i < 19; i++) {
  1668.  
  1669. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1670. if (val <= Bouncepos)
  1671. fade(i, default_col_1, default_col_2, val );
  1672. else
  1673. leds[i] = CRGB::Black;
  1674. }
  1675.  
  1676.  
  1677. for ( int i = 19; i < 37; i++) {
  1678.  
  1679. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1680. if (val <= Bouncepos)
  1681. fade(i, default_col_1, default_col_2, val );
  1682. else
  1683. leds[i] = CRGB::Black;
  1684. }
  1685. for ( int i = 37; i < 61; i++) {
  1686.  
  1687. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1688. if (val <= Bouncepos)
  1689. fade(i, default_col_1, default_col_2, val );
  1690. else
  1691. leds[i] = CRGB::Black;
  1692. }
  1693. }
  1694.  
  1695. if (Bouncephase == 2) {
  1696. Bouncepos -= Bouncespeed;
  1697. if (Bouncepos <= -20) {
  1698. Bouncepos = 100;
  1699. Bouncephase = 3;
  1700. }
  1701.  
  1702. if (50 <= Bouncepos)
  1703. fade(0, default_col_1, default_col_2, 50 );
  1704. else
  1705. leds[0] = CRGB::Black;
  1706. for ( int i = 1; i < 7; i++) {
  1707.  
  1708. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1709. if (val <= Bouncepos)
  1710. fade(i, default_col_1, default_col_2, val );
  1711. else
  1712. leds[i] = CRGB::Black;
  1713. }
  1714. for ( int i = 7; i < 19; i++) {
  1715.  
  1716. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1717. if (val <= Bouncepos)
  1718. fade(i, default_col_1, default_col_2, val );
  1719. else
  1720. leds[i] = CRGB::Black;
  1721. }
  1722.  
  1723.  
  1724. for ( int i = 19; i < 37; i++) {
  1725.  
  1726. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1727. if (val <= Bouncepos)
  1728. fade(i, default_col_1, default_col_2, val );
  1729. else
  1730. leds[i] = CRGB::Black;
  1731. }
  1732. for ( int i = 37; i < 61; i++) {
  1733.  
  1734. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1735. if (val <= Bouncepos)
  1736. fade(i, default_col_1, default_col_2, val );
  1737. else
  1738. leds[i] = CRGB::Black;
  1739. }
  1740.  
  1741.  
  1742. }
  1743. if (Bouncephase == 3) {
  1744. Bouncepos -= Bouncespeed;
  1745. if (Bouncepos <= -20) {
  1746. Bouncepos = 0;
  1747. Bouncephase = 4;
  1748. }
  1749. if (50 >= Bouncepos)
  1750. fade(0, default_col_1, default_col_2, 50 );
  1751. else
  1752. leds[0] = CRGB::Black;
  1753. for ( int i = 1; i < 7; i++) {
  1754.  
  1755. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1756. if (val >= Bouncepos)
  1757. fade(i, default_col_1, default_col_2, val );
  1758. else
  1759. leds[i] = CRGB::Black;
  1760. }
  1761. for ( int i = 7; i < 19; i++) {
  1762.  
  1763. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1764. if (val >= Bouncepos)
  1765. fade(i, default_col_1, default_col_2, val );
  1766. else
  1767. leds[i] = CRGB::Black;
  1768. }
  1769.  
  1770.  
  1771. for ( int i = 19; i < 37; i++) {
  1772.  
  1773. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1774. if (val >= Bouncepos)
  1775. fade(i, default_col_1, default_col_2, val );
  1776. else
  1777. leds[i] = CRGB::Black;
  1778. }
  1779. for ( int i = 37; i < 61; i++) {
  1780.  
  1781. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1782. if (val >= Bouncepos)
  1783. fade(i, default_col_1, default_col_2, val );
  1784. else
  1785. leds[i] = CRGB::Black;
  1786. }
  1787. }
  1788.  
  1789. if (Bouncephase == 4) {
  1790. Bouncepos += Bouncespeed;
  1791.  
  1792.  
  1793. if (50 >= Bouncepos)
  1794. fade(0, default_col_1, default_col_2, 50 );
  1795. else
  1796. leds[0] = CRGB::Black;
  1797. for ( int i = 1; i < 7; i++) {
  1798.  
  1799. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1800. if (val >= Bouncepos)
  1801. fade(i, default_col_1, default_col_2, val );
  1802. else
  1803. leds[i] = CRGB::Black;
  1804. }
  1805. for ( int i = 7; i < 19; i++) {
  1806.  
  1807. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1808. if (val >= Bouncepos)
  1809. fade(i, default_col_1, default_col_2, val );
  1810. else
  1811. leds[i] = CRGB::Black;
  1812. }
  1813.  
  1814.  
  1815. for ( int i = 19; i < 37; i++) {
  1816.  
  1817. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1818. if (val >= Bouncepos)
  1819. fade(i, default_col_1, default_col_2, val );
  1820. else
  1821. leds[i] = CRGB::Black;
  1822. }
  1823. for ( int i = 37; i < 61; i++) {
  1824.  
  1825. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1826. if (val >= Bouncepos)
  1827. fade(i, default_col_1, default_col_2, val );
  1828. else
  1829. leds[i] = CRGB::Black;
  1830. }
  1831. if (Bouncepos >= 120) {
  1832. Bouncepos = 0;
  1833. Bouncephase = 1;
  1834. FastLED.clear();
  1835. FastLED.show();
  1836. }
  1837. }
  1838.  
  1839. FastLED.show();
  1840.  
  1841.  
  1842. }
  1843. }
  1844. void do_Bounce_Linear_Rainbow() {
  1845. int Bouncespeed = 15;
  1846. if (millis() - mil >= map(anispeed, 0, 100, 120, 30)) { // speedy
  1847. mil = millis();
  1848.  
  1849.  
  1850.  
  1851. if (Bouncephase == 1) {
  1852. Bouncepos += Bouncespeed;
  1853. if (Bouncepos >= 120) {
  1854. Bouncepos = 100;
  1855. Bouncephase = 2;
  1856. }
  1857. if (50 <= Bouncepos)
  1858. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  1859. else
  1860. leds[0] = CRGB::Black;
  1861. for ( int i = 1; i < 7; i++) {
  1862.  
  1863. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1864. if (val <= Bouncepos)
  1865. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1866. else
  1867. leds[i] = CRGB::Black;
  1868. }
  1869. for ( int i = 7; i < 19; i++) {
  1870.  
  1871. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1872. if (val <= Bouncepos)
  1873. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1874. else
  1875. leds[i] = CRGB::Black;
  1876. }
  1877.  
  1878.  
  1879. for ( int i = 19; i < 37; i++) {
  1880.  
  1881. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1882. if (val <= Bouncepos)
  1883. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1884. else
  1885. leds[i] = CRGB::Black;
  1886. }
  1887. for ( int i = 37; i < 61; i++) {
  1888.  
  1889. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1890. if (val <= Bouncepos)
  1891. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1892. else
  1893. leds[i] = CRGB::Black;
  1894. }
  1895. }
  1896.  
  1897. if (Bouncephase == 2) {
  1898. Bouncepos -= Bouncespeed;
  1899. if (Bouncepos <= -20) {
  1900. Bouncepos = 100;
  1901. Bouncephase = 3;
  1902. }
  1903.  
  1904. if (50 <= Bouncepos)
  1905. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  1906. else
  1907. leds[0] = CRGB::Black;
  1908. for ( int i = 1; i < 7; i++) {
  1909.  
  1910. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1911. if (val <= Bouncepos)
  1912. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1913. else
  1914. leds[i] = CRGB::Black;
  1915. }
  1916. for ( int i = 7; i < 19; i++) {
  1917.  
  1918. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1919. if (val <= Bouncepos)
  1920. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1921. else
  1922. leds[i] = CRGB::Black;
  1923. }
  1924.  
  1925.  
  1926. for ( int i = 19; i < 37; i++) {
  1927.  
  1928. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1929. if (val <= Bouncepos)
  1930. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1931. else
  1932. leds[i] = CRGB::Black;
  1933. }
  1934. for ( int i = 37; i < 61; i++) {
  1935.  
  1936. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1937. if (val <= Bouncepos)
  1938. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1939. else
  1940. leds[i] = CRGB::Black;
  1941. }
  1942.  
  1943.  
  1944. }
  1945. if (Bouncephase == 3) {
  1946. Bouncepos -= Bouncespeed;
  1947. if (Bouncepos <= -20) {
  1948. Bouncepos = 0;
  1949. Bouncephase = 4;
  1950. }
  1951. if (50 >= Bouncepos)
  1952. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  1953. else
  1954. leds[0] = CRGB::Black;
  1955. for ( int i = 1; i < 7; i++) {
  1956.  
  1957. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1958. if (val >= Bouncepos)
  1959. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1960. else
  1961. leds[i] = CRGB::Black;
  1962. }
  1963. for ( int i = 7; i < 19; i++) {
  1964.  
  1965. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1966. if (val >= Bouncepos)
  1967. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1968. else
  1969. leds[i] = CRGB::Black;
  1970. }
  1971.  
  1972.  
  1973. for ( int i = 19; i < 37; i++) {
  1974.  
  1975. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1976. if (val >= Bouncepos)
  1977. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1978. else
  1979. leds[i] = CRGB::Black;
  1980. }
  1981. for ( int i = 37; i < 61; i++) {
  1982.  
  1983. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  1984. if (val >= Bouncepos)
  1985. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  1986. else
  1987. leds[i] = CRGB::Black;
  1988. }
  1989. }
  1990.  
  1991. if (Bouncephase == 4) {
  1992. Bouncepos += Bouncespeed;
  1993.  
  1994.  
  1995. if (50 >= Bouncepos)
  1996. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  1997. else
  1998. leds[0] = CRGB::Black;
  1999. for ( int i = 1; i < 7; i++) {
  2000.  
  2001. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2002. if (val >= Bouncepos)
  2003. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  2004. else
  2005. leds[i] = CRGB::Black;
  2006. }
  2007. for ( int i = 7; i < 19; i++) {
  2008.  
  2009. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2010. if (val >= Bouncepos)
  2011. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  2012. else
  2013. leds[i] = CRGB::Black;
  2014. }
  2015.  
  2016.  
  2017. for ( int i = 19; i < 37; i++) {
  2018.  
  2019. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2020. if (val >= Bouncepos)
  2021. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  2022. else
  2023. leds[i] = CRGB::Black;
  2024. }
  2025. for ( int i = 37; i < 61; i++) {
  2026.  
  2027. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2028. if (val >= Bouncepos)
  2029. leds[i] = ColorFromPalette( RainbowColors_p, map(val, 0, 100, 0, 255), 255, LINEARBLEND);
  2030. else
  2031. leds[i] = CRGB::Black;
  2032. }
  2033. if (Bouncepos >= 120) {
  2034. Bouncepos = 0;
  2035. Bouncephase = 1;
  2036. FastLED.clear();
  2037. FastLED.show();
  2038. }
  2039. }
  2040.  
  2041. FastLED.show();
  2042.  
  2043.  
  2044. }
  2045. }
  2046.  
  2047. void do_Bounce_Linear_Static() {
  2048. int Bouncespeed = 15;
  2049. if (millis() - mil >= map(anispeed, 0, 100, 120, 30)) { // speedy
  2050. mil = millis();
  2051.  
  2052.  
  2053.  
  2054. if (Bouncephase == 1) {
  2055. Bouncepos += Bouncespeed;
  2056. if (Bouncepos >= 120) {
  2057. Bouncepos = 100;
  2058. Bouncephase = 2;
  2059. }
  2060. if (50 <= Bouncepos)
  2061. leds[0] = CRGB(static_r, static_g, static_b);
  2062. else
  2063. leds[0] = CRGB::Black;
  2064. for ( int i = 1; i < 7; i++) {
  2065.  
  2066. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2067. if (val <= Bouncepos)
  2068. leds[i] = CRGB(static_r, static_g, static_b);
  2069. else
  2070. leds[i] = CRGB::Black;
  2071. }
  2072. for ( int i = 7; i < 19; i++) {
  2073.  
  2074. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2075. if (val <= Bouncepos)
  2076. leds[i] = CRGB(static_r, static_g, static_b);
  2077. else
  2078. leds[i] = CRGB::Black;
  2079. }
  2080.  
  2081.  
  2082. for ( int i = 19; i < 37; i++) {
  2083.  
  2084. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2085. if (val <= Bouncepos)
  2086. leds[i] = CRGB(static_r, static_g, static_b);
  2087. else
  2088. leds[i] = CRGB::Black;
  2089. }
  2090. for ( int i = 37; i < 61; i++) {
  2091.  
  2092. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2093. if (val <= Bouncepos)
  2094. leds[i] = CRGB(static_r, static_g, static_b);
  2095. else
  2096. leds[i] = CRGB::Black;
  2097. }
  2098. }
  2099.  
  2100. if (Bouncephase == 2) {
  2101. Bouncepos -= Bouncespeed;
  2102. if (Bouncepos <= -20) {
  2103. Bouncepos = 100;
  2104. Bouncephase = 3;
  2105. }
  2106.  
  2107. if (50 <= Bouncepos)
  2108. leds[0] = CRGB(static_r, static_g, static_b);
  2109. else
  2110. leds[0] = CRGB::Black;
  2111. for ( int i = 1; i < 7; i++) {
  2112.  
  2113. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2114. if (val <= Bouncepos)
  2115. leds[i] = CRGB(static_r, static_g, static_b);
  2116. else
  2117. leds[i] = CRGB::Black;
  2118. }
  2119. for ( int i = 7; i < 19; i++) {
  2120.  
  2121. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2122. if (val <= Bouncepos)
  2123. leds[i] = CRGB(static_r, static_g, static_b);
  2124. else
  2125. leds[i] = CRGB::Black;
  2126. }
  2127.  
  2128.  
  2129. for ( int i = 19; i < 37; i++) {
  2130.  
  2131. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2132. if (val <= Bouncepos)
  2133. leds[i] = CRGB(static_r, static_g, static_b);
  2134. else
  2135. leds[i] = CRGB::Black;
  2136. }
  2137. for ( int i = 37; i < 61; i++) {
  2138.  
  2139. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2140. if (val <= Bouncepos)
  2141. leds[i] = CRGB(static_r, static_g, static_b);
  2142. else
  2143. leds[i] = CRGB::Black;
  2144. }
  2145.  
  2146.  
  2147. }
  2148. if (Bouncephase == 3) {
  2149. Bouncepos -= Bouncespeed;
  2150. if (Bouncepos <= -20) {
  2151. Bouncepos = 0;
  2152. Bouncephase = 4;
  2153. }
  2154. if (50 >= Bouncepos)
  2155. leds[0] = CRGB(static_r, static_g, static_b);
  2156. else
  2157. leds[0] = CRGB::Black;
  2158. for ( int i = 1; i < 7; i++) {
  2159.  
  2160. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2161. if (val >= Bouncepos)
  2162. leds[i] = CRGB(static_r, static_g, static_b);
  2163. else
  2164. leds[i] = CRGB::Black;
  2165. }
  2166. for ( int i = 7; i < 19; i++) {
  2167.  
  2168. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2169. if (val >= Bouncepos)
  2170. leds[i] = CRGB(static_r, static_g, static_b);
  2171. else
  2172. leds[i] = CRGB::Black;
  2173. }
  2174.  
  2175.  
  2176. for ( int i = 19; i < 37; i++) {
  2177.  
  2178. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2179. if (val >= Bouncepos)
  2180. leds[i] = CRGB(static_r, static_g, static_b);
  2181. else
  2182. leds[i] = CRGB::Black;
  2183. }
  2184. for ( int i = 37; i < 61; i++) {
  2185.  
  2186. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2187. if (val >= Bouncepos)
  2188. leds[i] = CRGB(static_r, static_g, static_b);
  2189. else
  2190. leds[i] = CRGB::Black;
  2191. }
  2192. }
  2193.  
  2194. if (Bouncephase == 4) {
  2195. Bouncepos += Bouncespeed;
  2196.  
  2197.  
  2198. if (50 >= Bouncepos)
  2199. leds[0] = CRGB(static_r, static_g, static_b);
  2200. else
  2201. leds[0] = CRGB::Black;
  2202. for ( int i = 1; i < 7; i++) {
  2203.  
  2204. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2205. if (val >= Bouncepos)
  2206. leds[i] = CRGB(static_r, static_g, static_b);
  2207. else
  2208. leds[i] = CRGB::Black;
  2209. }
  2210. for ( int i = 7; i < 19; i++) {
  2211.  
  2212. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2213. if (val >= Bouncepos)
  2214. leds[i] = CRGB(static_r, static_g, static_b);
  2215. else
  2216. leds[i] = CRGB::Black;
  2217. }
  2218.  
  2219.  
  2220. for ( int i = 19; i < 37; i++) {
  2221.  
  2222. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2223. if (val >= Bouncepos)
  2224. leds[i] = CRGB(static_r, static_g, static_b);
  2225. else
  2226. leds[i] = CRGB::Black;
  2227. }
  2228. for ( int i = 37; i < 61; i++) {
  2229.  
  2230. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2231. if (val >= Bouncepos)
  2232. leds[i] = CRGB(static_r, static_g, static_b);
  2233. else
  2234. leds[i] = CRGB::Black;
  2235. }
  2236. if (Bouncepos >= 120) {
  2237. Bouncepos = 0;
  2238. Bouncephase = 1;
  2239. FastLED.clear();
  2240. FastLED.show();
  2241. }
  2242. }
  2243.  
  2244. FastLED.show();
  2245.  
  2246.  
  2247. }
  2248. }
  2249. void do_Visor_MC() {
  2250. int vislength = 2;
  2251. if (millis() - mil >= map(anispeed, 0, 100, 200, 20)) {
  2252. mil = millis();
  2253. // set point
  2254. fade(0, default_col_1, default_col_2, 50 );
  2255. for ( int i = 1; i < 7; i++) {
  2256.  
  2257. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2258.  
  2259. fade(i, default_col_1, default_col_2, val );
  2260. }
  2261. for ( int i = 7; i < 19; i++) {
  2262.  
  2263. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2264. fade(i, default_col_1, default_col_2, val );
  2265. }
  2266.  
  2267.  
  2268. for ( int i = 19; i < 37; i++) {
  2269.  
  2270. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2271. fade(i, default_col_1, default_col_2, val );
  2272. }
  2273. for ( int i = 37; i < 61; i++) {
  2274.  
  2275. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2276. fade(i, default_col_1, default_col_2, val );
  2277. }
  2278.  
  2279.  
  2280. vispos++;
  2281. if (vispos > 61)
  2282. vispos = 0;
  2283. for ( int i = 0; i < 61; i++) {
  2284. if (abs(i - vispos) > vislength)
  2285. leds[i] = CRGB::Black;
  2286. if (i - vispos == 0)
  2287. leds[i] = CRGB(leds[i].r * 0.7, leds[i].g * 0.7, leds[i].b * 0.7);
  2288. if (i - vispos == -1)
  2289. leds[i] = CRGB(leds[i].r * 0.5, leds[i].g * 0.5, leds[i].b * 0.5);
  2290. if (i - vispos == -2) {
  2291. leds[i] = CRGB(leds[i].r * 0.2, leds[i].g * 0.2, leds[i].b * 0.2);
  2292.  
  2293. Serial.println(vispos);
  2294. }
  2295. }
  2296.  
  2297. FastLED.show();
  2298.  
  2299.  
  2300. }
  2301. }
  2302.  
  2303. void do_Visor_Static() {
  2304. int vislength = 2;
  2305. if (millis() - mil >= map(anispeed, 0, 100, 200, 20)) {
  2306. mil = millis();
  2307. // set point
  2308. fill_solid(leds, 61, CRGB(static_r, static_g, static_b));
  2309.  
  2310.  
  2311. vispos++;
  2312. if (vispos > 61)
  2313. vispos = 0;
  2314. for ( int i = 0; i < 61; i++) {
  2315. if (abs(i - vispos) > vislength)
  2316. leds[i] = CRGB::Black;
  2317. if (i - vispos == 0)
  2318. leds[i] = CRGB(leds[i].r * 0.7, leds[i].g * 0.7, leds[i].b * 0.7);
  2319. if (i - vispos == -1)
  2320. leds[i] = CRGB(leds[i].r * 0.5, leds[i].g * 0.5, leds[i].b * 0.5);
  2321. if (i - vispos == -2) {
  2322. leds[i] = CRGB(leds[i].r * 0.2, leds[i].g * 0.2, leds[i].b * 0.2);
  2323.  
  2324. Serial.println(vispos);
  2325. }
  2326. }
  2327.  
  2328. FastLED.show();
  2329.  
  2330.  
  2331. }
  2332. }
  2333. void do_Visor_Rainbow() {
  2334. int vislength = 2;
  2335. if (millis() - mil >= map(anispeed, 0, 100, 200, 20)) {
  2336. mil = millis();
  2337. // set point
  2338. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  2339. for ( int i = 1; i < 7; i++) {
  2340.  
  2341. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2342. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2343. }
  2344. for ( int i = 7; i < 19; i++) {
  2345.  
  2346. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2347. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2348. }
  2349.  
  2350.  
  2351. for ( int i = 19; i < 37; i++) {
  2352.  
  2353. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2354. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2355. }
  2356. for ( int i = 37; i < 61; i++) {
  2357.  
  2358. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2359. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2360. }
  2361.  
  2362.  
  2363. vispos++;
  2364. if (vispos > 61)
  2365. vispos = 0;
  2366. for ( int i = 0; i < 61; i++) {
  2367. if (abs(i - vispos) > vislength)
  2368. leds[i] = CRGB::Black;
  2369. if (i - vispos == 0)
  2370. leds[i] = CRGB(leds[i].r * 0.7, leds[i].g * 0.7, leds[i].b * 0.7);
  2371. if (i - vispos == -1)
  2372. leds[i] = CRGB(leds[i].r * 0.5, leds[i].g * 0.5, leds[i].b * 0.5);
  2373. if (i - vispos == -2) {
  2374. leds[i] = CRGB(leds[i].r * 0.2, leds[i].g * 0.2, leds[i].b * 0.2);
  2375.  
  2376. Serial.println(vispos);
  2377. }
  2378. }
  2379.  
  2380. FastLED.show();
  2381.  
  2382.  
  2383. }
  2384. }
  2385. void do_Segment_Rainbow() {
  2386. if (millis() - mil >= map(anispeed, 0, 100, 250, 0)) {
  2387. mil = millis();
  2388. spos++;
  2389. if (spos >= 24)
  2390. spos = 0;
  2391. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  2392. for ( int i = 1; i < 7; i++) {
  2393.  
  2394. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2395. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2396. if (((i - 1) * (360 / 6) >= 15 * spos and ((i - 1) * (360 / 6)) <= 15 * (spos + 4)) == 0) {
  2397. if ((spos == 20 and i - 1 == 0) == 0)
  2398. if ((spos == 21 and i - 1 == 0) == 0)
  2399. if ((spos == 22 and i - 1 == 0) == 0)
  2400. if ((spos == 23 and i - 1 == 0) == 0)
  2401. leds[i] = CRGB::Black;
  2402. }
  2403. }
  2404. for ( int i = 7; i < 19; i++) {
  2405.  
  2406. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2407. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2408. if (((i - 7) * (360 / 12) >= 15 * spos and ((i - 7) * (360 / 12)) <= 15 * (spos + 4)) == 0) {
  2409. if ((spos == 20 and i - 7 == 0) == 0)
  2410. if ((spos == 21 and i - 7 == 0) == 0)
  2411. if ((spos == 22 and i - 7 == 0) == 0)
  2412. if ((spos == 22 and i - 7 == 1) == 0)
  2413. if ((spos == 23 and i - 7 == 0) == 0)
  2414. if ((spos == 23 and i - 7 == 1) == 0)
  2415. leds[i] = CRGB::Black;
  2416. }
  2417. }
  2418.  
  2419.  
  2420. for ( int i = 19; i < 37; i++) {
  2421.  
  2422. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2423. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2424. if (((i - 19) * (360 / 18) >= 15 * spos and ((i - 19) * (360 / 18)) <= 15 * (spos + 4)) == 0) {
  2425. if ((spos == 20 and i - 19 == 0) == 0)
  2426. if ((spos == 21 and i - 19 == 0) == 0)
  2427. if ((spos == 21 and i - 19 == 1) == 0)
  2428. if ((spos == 22 and i - 19 == 0) == 0)
  2429. if ((spos == 22 and i - 19 == 1) == 0)
  2430. if ((spos == 23 and i - 19 == 0) == 0)
  2431. if ((spos == 23 and i - 19 == 1) == 0)
  2432. if ((spos == 23 and i - 19 == 2) == 0)
  2433. leds[i] = CRGB::Black;
  2434. }
  2435. }
  2436. for ( int i = 37; i < 61; i++) {
  2437.  
  2438. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2439. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2440. if (((i - 37) * (360 / 24) >= 15 * spos and ((i - 37) * (360 / 24)) <= 15 * (spos + 4)) == 0) {
  2441. if ((spos == 20 and i - 37 == 0) == 0)
  2442. if ((spos == 21 and i - 37 == 0) == 0)
  2443. if ((spos == 21 and i - 37 == 1) == 0)
  2444. if ((spos == 22 and i - 37 == 0) == 0)
  2445. if ((spos == 22 and i - 37 == 1) == 0)
  2446. if ((spos == 22 and i - 37 == 2) == 0)
  2447. if ((spos == 23 and i - 37 == 3) == 0)
  2448. if ((spos == 23 and i - 37 == 0) == 0)
  2449. if ((spos == 23 and i - 37 == 1) == 0)
  2450. if ((spos == 23 and i - 37 == 2) == 0)
  2451. leds[i] = CRGB::Black;
  2452. }
  2453. }
  2454.  
  2455. FastLED.show();
  2456. }
  2457. }
  2458. void do_Segment_MC() {
  2459. if (millis() - mil >= map(anispeed, 0, 100, 250, 0)) {
  2460. mil = millis();
  2461. spos++;
  2462. if (spos >= 24)
  2463. spos = 0;
  2464. leds[0] = ColorFromPalette( MC_p, 128, 255, LINEARBLEND);
  2465. for ( int i = 1; i < 7; i++) {
  2466.  
  2467. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2468. leds[i] = ColorFromPalette( MC_p, val, 255, LINEARBLEND);
  2469. if (((i - 1) * (360 / 6) >= 15 * spos and ((i - 1) * (360 / 6)) <= 15 * (spos + 4)) == 0) {
  2470. if ((spos == 20 and i - 1 == 0) == 0)
  2471. if ((spos == 21 and i - 1 == 0) == 0)
  2472. if ((spos == 22 and i - 1 == 0) == 0)
  2473. if ((spos == 23 and i - 1 == 0) == 0)
  2474. leds[i] = CRGB::Black;
  2475. }
  2476. }
  2477. for ( int i = 7; i < 19; i++) {
  2478.  
  2479. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2480. leds[i] = ColorFromPalette( MC_p, val, 255, LINEARBLEND);
  2481. if (((i - 7) * (360 / 12) >= 15 * spos and ((i - 7) * (360 / 12)) <= 15 * (spos + 4)) == 0) {
  2482. if ((spos == 20 and i - 7 == 0) == 0)
  2483. if ((spos == 21 and i - 7 == 0) == 0)
  2484. if ((spos == 22 and i - 7 == 0) == 0)
  2485. if ((spos == 22 and i - 7 == 1) == 0)
  2486. if ((spos == 23 and i - 7 == 0) == 0)
  2487. if ((spos == 23 and i - 7 == 1) == 0)
  2488. leds[i] = CRGB::Black;
  2489. }
  2490. }
  2491.  
  2492.  
  2493. for ( int i = 19; i < 37; i++) {
  2494.  
  2495. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2496. leds[i] = ColorFromPalette( MC_p, val, 255, LINEARBLEND);
  2497. if (((i - 19) * (360 / 18) >= 15 * spos and ((i - 19) * (360 / 18)) <= 15 * (spos + 4)) == 0) {
  2498. if ((spos == 20 and i - 19 == 0) == 0)
  2499. if ((spos == 21 and i - 19 == 0) == 0)
  2500. if ((spos == 21 and i - 19 == 1) == 0)
  2501. if ((spos == 22 and i - 19 == 0) == 0)
  2502. if ((spos == 22 and i - 19 == 1) == 0)
  2503. if ((spos == 23 and i - 19 == 0) == 0)
  2504. if ((spos == 23 and i - 19 == 1) == 0)
  2505. if ((spos == 23 and i - 19 == 2) == 0)
  2506. leds[i] = CRGB::Black;
  2507. }
  2508. }
  2509. for ( int i = 37; i < 61; i++) {
  2510.  
  2511. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2512. leds[i] = ColorFromPalette( MC_p, val, 255, LINEARBLEND);
  2513. if (((i - 37) * (360 / 24) >= 15 * spos and ((i - 37) * (360 / 24)) <= 15 * (spos + 4)) == 0) {
  2514. if ((spos == 20 and i - 37 == 0) == 0)
  2515. if ((spos == 21 and i - 37 == 0) == 0)
  2516. if ((spos == 21 and i - 37 == 1) == 0)
  2517. if ((spos == 22 and i - 37 == 0) == 0)
  2518. if ((spos == 22 and i - 37 == 1) == 0)
  2519. if ((spos == 22 and i - 37 == 2) == 0)
  2520. if ((spos == 23 and i - 37 == 3) == 0)
  2521. if ((spos == 23 and i - 37 == 0) == 0)
  2522. if ((spos == 23 and i - 37 == 1) == 0)
  2523. if ((spos == 23 and i - 37 == 2) == 0)
  2524. leds[i] = CRGB::Black;
  2525. }
  2526. }
  2527.  
  2528. FastLED.show();
  2529. }
  2530. }
  2531.  
  2532. void do_Segment_Static() {
  2533. if (millis() - mil >= map(anispeed, 0, 100, 250, 0)) {
  2534. mil = millis();
  2535. spos++;
  2536. if (spos >= 24)
  2537. spos = 0;
  2538. leds[0] = CRGB(static_r, static_g, static_b);
  2539. for ( int i = 1; i < 7; i++) {
  2540.  
  2541. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2542. leds[i] = CRGB(static_r, static_g, static_b);
  2543. if (((i - 1) * (360 / 6) >= 15 * spos and ((i - 1) * (360 / 6)) <= 15 * (spos + 4)) == 0) {
  2544. if ((spos == 20 and i - 1 == 0) == 0)
  2545. if ((spos == 21 and i - 1 == 0) == 0)
  2546. if ((spos == 22 and i - 1 == 0) == 0)
  2547. if ((spos == 23 and i - 1 == 0) == 0)
  2548. leds[i] = CRGB::Black;
  2549. }
  2550. }
  2551. for ( int i = 7; i < 19; i++) {
  2552.  
  2553. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2554. leds[i] = CRGB(static_r, static_g, static_b);
  2555. if (((i - 7) * (360 / 12) >= 15 * spos and ((i - 7) * (360 / 12)) <= 15 * (spos + 4)) == 0) {
  2556. if ((spos == 20 and i - 7 == 0) == 0)
  2557. if ((spos == 21 and i - 7 == 0) == 0)
  2558. if ((spos == 22 and i - 7 == 0) == 0)
  2559. if ((spos == 22 and i - 7 == 1) == 0)
  2560. if ((spos == 23 and i - 7 == 0) == 0)
  2561. if ((spos == 23 and i - 7 == 1) == 0)
  2562. leds[i] = CRGB::Black;
  2563. }
  2564. }
  2565.  
  2566.  
  2567. for ( int i = 19; i < 37; i++) {
  2568.  
  2569. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2570. leds[i] = CRGB(static_r, static_g, static_b);
  2571. if (((i - 19) * (360 / 18) >= 15 * spos and ((i - 19) * (360 / 18)) <= 15 * (spos + 4)) == 0) {
  2572. if ((spos == 20 and i - 19 == 0) == 0)
  2573. if ((spos == 21 and i - 19 == 0) == 0)
  2574. if ((spos == 21 and i - 19 == 1) == 0)
  2575. if ((spos == 22 and i - 19 == 0) == 0)
  2576. if ((spos == 22 and i - 19 == 1) == 0)
  2577. if ((spos == 23 and i - 19 == 0) == 0)
  2578. if ((spos == 23 and i - 19 == 1) == 0)
  2579. if ((spos == 23 and i - 19 == 2) == 0)
  2580. leds[i] = CRGB::Black;
  2581. }
  2582. }
  2583. for ( int i = 37; i < 61; i++) {
  2584.  
  2585. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2586. leds[i] = CRGB(static_r, static_g, static_b);
  2587. if (((i - 37) * (360 / 24) >= 15 * spos and ((i - 37) * (360 / 24)) <= 15 * (spos + 4)) == 0) {
  2588. if ((spos == 20 and i - 37 == 0) == 0)
  2589. if ((spos == 21 and i - 37 == 0) == 0)
  2590. if ((spos == 21 and i - 37 == 1) == 0)
  2591. if ((spos == 22 and i - 37 == 0) == 0)
  2592. if ((spos == 22 and i - 37 == 1) == 0)
  2593. if ((spos == 22 and i - 37 == 2) == 0)
  2594. if ((spos == 23 and i - 37 == 3) == 0)
  2595. if ((spos == 23 and i - 37 == 0) == 0)
  2596. if ((spos == 23 and i - 37 == 1) == 0)
  2597. if ((spos == 23 and i - 37 == 2) == 0)
  2598. leds[i] = CRGB::Black;
  2599. }
  2600. }
  2601.  
  2602. FastLED.show();
  2603. }
  2604. }
  2605.  
  2606.  
  2607. void do_Marquee_Rainbow() {
  2608. if (millis() - mil >= map(anispeed, 0, 100, 1250, 250)) {
  2609. mil = millis();
  2610. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  2611. for ( int i = 1; i < 7; i++) {
  2612.  
  2613. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2614. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2615. }
  2616. for ( int i = 7; i < 19; i++) {
  2617.  
  2618. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2619. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2620. }
  2621.  
  2622.  
  2623. for ( int i = 19; i < 37; i++) {
  2624.  
  2625. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2626. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2627. }
  2628. for ( int i = 37; i < 61; i++) {
  2629.  
  2630. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2631. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2632. }
  2633. for ( int i = 0; i < 61; i++) {
  2634. if (random(2))
  2635.  
  2636. leds[i] = CRGB::Black;
  2637. }
  2638.  
  2639. FastLED.show();
  2640. }
  2641. }
  2642. void do_Marquee_MC() {
  2643. if (millis() - mil >= map(anispeed, 0, 100, 1250, 250)) {
  2644. mil = millis();
  2645. fade(0, default_col_1, default_col_2, 50 );
  2646. for ( int i = 1; i < 7; i++) {
  2647.  
  2648. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2649.  
  2650. fade(i, default_col_1, default_col_2, val );
  2651. }
  2652. for ( int i = 7; i < 19; i++) {
  2653.  
  2654. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2655. fade(i, default_col_1, default_col_2, val );
  2656. }
  2657.  
  2658.  
  2659. for ( int i = 19; i < 37; i++) {
  2660.  
  2661. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2662. fade(i, default_col_1, default_col_2, val );
  2663. }
  2664. for ( int i = 37; i < 61; i++) {
  2665.  
  2666. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2667. fade(i, default_col_1, default_col_2, val );
  2668. }
  2669. for ( int i = 0; i < 61; i++) {
  2670. if (random(2))
  2671.  
  2672. leds[i] = CRGB::Black;
  2673. }
  2674.  
  2675. FastLED.show();
  2676. }
  2677. }
  2678. void do_Marquee_Static() {
  2679. if (millis() - mil >= map(anispeed, 0, 100, 1250, 250)) {
  2680. mil = millis();
  2681.  
  2682. for ( int i = 0; i < 61; i++) {
  2683. if (random(2))
  2684. leds[i] = CRGB(static_r, static_g, static_b);
  2685. else
  2686. leds[i] = CRGB::Black;
  2687. }
  2688.  
  2689. FastLED.show();
  2690. }
  2691. }
  2692. void do_Strobe_Rainbow() {
  2693. if (millis() - mil >= map(anispeed, 0, 100, 1500, 50)) {
  2694. mil = millis();
  2695. if (strpos) {
  2696. strpos = 0;
  2697. fill_solid(leds, 61, CRGB::Black);
  2698. }
  2699. else {
  2700. strpos = 1;
  2701. fill_solid(leds, 61, CRGB(random(255), random(255), random(255)));
  2702. }
  2703. FastLED.show();
  2704. }
  2705. }
  2706. void do_Strobe_MC() {
  2707. if (millis() - mil >= map(anispeed, 0, 100, 1500, 50)) {
  2708. mil = millis();
  2709. if (strpos) {
  2710. strpos = 0;
  2711. fill_solid(leds, 61, CRGB::Black);
  2712. }
  2713. else {
  2714. strpos = 1;
  2715. if (random(2))
  2716. fill_solid(leds, 61, default_col_1);
  2717. else
  2718. fill_solid(leds, 61, default_col_2);
  2719. }
  2720. FastLED.show();
  2721. }
  2722. }
  2723. void do_Strobe_Static() {
  2724. if (millis() - mil >= map(anispeed, 0, 100, 1500, 50)) {
  2725. mil = millis();
  2726. if (strpos) {
  2727. strpos = 0;
  2728. fill_solid(leds, 61, CRGB::Black);
  2729. }
  2730. else {
  2731. strpos = 1;
  2732. fill_solid(leds, 61, CRGB(static_r, static_g, static_b));
  2733. }
  2734. FastLED.show();
  2735. }
  2736. }
  2737. void do_Indiv_Jump_MC() {
  2738. if (millis() - mil >= map(anispeed, 0, 100, 1250, 250)) {
  2739. mil = millis();
  2740. for ( int i = 0; i < 61; i++) {
  2741. int val = random(5);
  2742. if (val == 5)
  2743. leds[i] = CRGB::Black;
  2744. else if (val % 2 == 0)
  2745. leds[i] = default_col_1;
  2746. else
  2747. leds[i] = default_col_2;
  2748.  
  2749. }
  2750. FastLED.show();
  2751. }
  2752. }
  2753. void do_Indiv_Jump_Rainbow() {
  2754. if (millis() - mil >= map(anispeed, 0, 100, 1250, 150)) {
  2755. mil = millis();
  2756. for ( int i = 0; i < 61; i++) {
  2757. leds[i] = CRGB(randomcols[random(3)], randomcols[random(3)], randomcols[random(3)]);
  2758. }
  2759. FastLED.show();
  2760. }
  2761. }
  2762. void do_All_Jump_Rainbow() {
  2763. if (millis() - mil >= map(anispeed, 0, 100, 1250, 150)) {
  2764. mil = millis();
  2765.  
  2766. fill_solid(leds, 61, CRGB(random(255), random(255), random(255)));
  2767.  
  2768. FastLED.show();
  2769. }
  2770. }
  2771. void do_Linear_MC_Gradient_2() {
  2772. if (millis() - mil >= 10) {
  2773. mil = millis();
  2774. fade(0, default_col_1, default_col_2, 50 );
  2775. for ( int i = 1; i < 7; i++) {
  2776.  
  2777. float val = (((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2778.  
  2779. fade(i, default_col_1, default_col_2, val );
  2780. }
  2781. for ( int i = 7; i < 19; i++) {
  2782.  
  2783. float val = (((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2784. fade(i, default_col_1, default_col_2, val );
  2785. }
  2786.  
  2787.  
  2788. for ( int i = 19; i < 37; i++) {
  2789.  
  2790. float val = (((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2791. fade(i, default_col_1, default_col_2, val );
  2792. }
  2793. for ( int i = 37; i < 61; i++) {
  2794.  
  2795. float val = (((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24 ;
  2796. fade(i, default_col_1, default_col_2, val );
  2797. }
  2798. FastLED.show();
  2799.  
  2800. }
  2801.  
  2802. }
  2803. void do_Linear_MC_Gradient_1() {
  2804. if (millis() - mil >= 10) {
  2805. mil = millis();
  2806. colorIndex = startIndex;
  2807. leds[0] = ColorFromPalette( MC_p, 128 + (180 - colorIndex), 255, LINEARBLEND);
  2808. for ( int i = 1; i < 7; i++) {
  2809.  
  2810. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2811. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2812. }
  2813. for ( int i = 7; i < 19; i++) {
  2814.  
  2815. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2816. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2817. }
  2818.  
  2819.  
  2820. for ( int i = 19; i < 37; i++) {
  2821.  
  2822. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2823. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2824. }
  2825. for ( int i = 37; i < 61; i++) {
  2826.  
  2827. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2828. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2829. }
  2830. colorIndex += 28;
  2831. FastLED.show();
  2832. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  2833. float wavspeed = wavspeedint / 10.0;
  2834. FastLED.show();
  2835. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  2836. if (startIndex > 255) {
  2837. startIndex = 0;
  2838. }
  2839. }
  2840.  
  2841. }
  2842. void do_Linear_MC_Gradient_3() {
  2843. if (millis() - mil >= 10) {
  2844. mil = millis();
  2845. colorIndex = startIndex;
  2846. leds[0] = ColorFromPalette( MC_p, 128 + (180 - colorIndex), 255, LINEARBLEND);
  2847. for ( int i = 1; i < 7; i++) {
  2848.  
  2849. float val = ((((3 * cos(((180 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2850. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2851. }
  2852. for ( int i = 7; i < 19; i++) {
  2853.  
  2854. float val = ((((6 * cos(((180 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2855. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2856. }
  2857.  
  2858.  
  2859. for ( int i = 19; i < 37; i++) {
  2860.  
  2861. float val = ((((9 * cos(((180 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2862. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2863. }
  2864. for ( int i = 37; i < 61; i++) {
  2865.  
  2866. float val = ((((12 * cos(((180 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2867. leds[i] = ColorFromPalette( MC_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2868. }
  2869. colorIndex += 28;
  2870. FastLED.show();
  2871. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  2872. float wavspeed = wavspeedint / 10.0;
  2873. FastLED.show();
  2874. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  2875. if (startIndex > 255) {
  2876. startIndex = 0;
  2877. }
  2878. }
  2879.  
  2880. }
  2881. void do_Linear_Rainbow_Gradient_1() {
  2882. if (millis() - mil >= 10) {
  2883. mil = millis();
  2884. colorIndex = startIndex;
  2885. leds[0] = ColorFromPalette( RainbowColors_p, 128 + (180 - colorIndex), 255, LINEARBLEND);
  2886. for ( int i = 1; i < 7; i++) {
  2887.  
  2888. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2889. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2890. }
  2891. for ( int i = 7; i < 19; i++) {
  2892.  
  2893. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2894. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2895. }
  2896.  
  2897.  
  2898. for ( int i = 19; i < 37; i++) {
  2899.  
  2900. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2901. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2902. }
  2903. for ( int i = 37; i < 61; i++) {
  2904.  
  2905. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2906. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2907. }
  2908. colorIndex += 28;
  2909. FastLED.show();
  2910. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  2911. float wavspeed = wavspeedint / 10.0;
  2912. FastLED.show();
  2913. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  2914. if (startIndex > 255) {
  2915. startIndex = 0;
  2916. }
  2917. }
  2918.  
  2919. }
  2920.  
  2921. void do_Linear_Rainbow_Gradient_2() {
  2922. if (millis() - mil >= 10) {
  2923. mil = millis();
  2924. leds[0] = ColorFromPalette( RainbowColors_p, 128, 255, LINEARBLEND);
  2925. for ( int i = 1; i < 7; i++) {
  2926.  
  2927. float val = ((((3 * cos(((90 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2928. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2929. }
  2930. for ( int i = 7; i < 19; i++) {
  2931.  
  2932. float val = ((((6 * cos(((90 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2933. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2934. }
  2935.  
  2936.  
  2937. for ( int i = 19; i < 37; i++) {
  2938.  
  2939. float val = ((((9 * cos(((90 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2940. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2941. }
  2942. for ( int i = 37; i < 61; i++) {
  2943.  
  2944. float val = ((((12 * cos(((90 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2945. leds[i] = ColorFromPalette( RainbowColors_p, val, 255, LINEARBLEND);
  2946. }
  2947. FastLED.show();
  2948.  
  2949. }
  2950.  
  2951. }
  2952. void do_Linear_Rainbow_Gradient_3() {
  2953. if (millis() - mil >= 10) {
  2954. mil = millis();
  2955. colorIndex = startIndex;
  2956. leds[0] = ColorFromPalette( RainbowColors_p, 128 + (180 - colorIndex), 255, LINEARBLEND);
  2957. for ( int i = 1; i < 7; i++) {
  2958.  
  2959. float val = ((((3 * cos(((180 + ((i - 1) * (360.0 / 6.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2960. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2961. }
  2962. for ( int i = 7; i < 19; i++) {
  2963.  
  2964. float val = ((((6 * cos(((180 + ((i - 7) * (360.0 / 12.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2965. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2966. }
  2967.  
  2968.  
  2969. for ( int i = 19; i < 37; i++) {
  2970.  
  2971. float val = ((((9 * cos(((180 + ((i - 19) * (360.0 / 18.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2972. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2973. }
  2974. for ( int i = 37; i < 61; i++) {
  2975.  
  2976. float val = ((((12 * cos(((180 + ((i - 37) * (360.0 / 24.0))) * 71) / 4068 )) + 12) * 100) / 24) * 2.55 ;
  2977. leds[i] = ColorFromPalette( RainbowColors_p, val + (180 - colorIndex), 255, LINEARBLEND);
  2978. }
  2979. colorIndex += 28;
  2980. FastLED.show();
  2981. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  2982. float wavspeed = wavspeedint / 10.0;
  2983. FastLED.show();
  2984. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  2985. if (startIndex > 255) {
  2986. startIndex = 0;
  2987. }
  2988. }
  2989.  
  2990. }
  2991. void do_Spiral_MC_Wave_1() {
  2992. if (millis() - mil >= 10) {
  2993. mil = millis();
  2994. colorIndex = startIndex;
  2995. for ( int i = 0; i < 1; i++) {
  2996. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  2997.  
  2998.  
  2999. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3000.  
  3001. colorIndex = colorIndex + 1; //how fast to advance through palette 3
  3002. }
  3003. colorIndex = startIndex;
  3004. for ( int i = 1; i < 7; i++) {
  3005. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3006.  
  3007.  
  3008. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3009.  
  3010. colorIndex = colorIndex + 42; //how fast to advance through palette 3
  3011. }
  3012. for ( int i = 7; i < 19; i++) {
  3013. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3014.  
  3015.  
  3016. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3017.  
  3018. colorIndex = colorIndex + 21; //how fast to advance through palette 3
  3019. }
  3020.  
  3021. for ( int i = 19; i < 37; i++) {
  3022. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3023.  
  3024.  
  3025. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3026.  
  3027. colorIndex = colorIndex + 14; //how fast to advance through palette 3
  3028. }
  3029. colorIndex = startIndex;
  3030. for ( int i = 37; i < 61; i++) {
  3031. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3032.  
  3033.  
  3034. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3035.  
  3036. colorIndex = colorIndex + 11; //how fast to advance through palette 3
  3037. }
  3038. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  3039. float wavspeed = wavspeedint / 10.0;
  3040. FastLED.show();
  3041. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  3042. if (startIndex > 255) {
  3043. startIndex = 0;
  3044. }
  3045. }//end_every_n
  3046. }
  3047.  
  3048. void do_Spiral_MC_Wave_2() {
  3049. if (millis() - mil >= 10) {
  3050. mil = millis();
  3051. colorIndex = startIndex;
  3052. for ( int i = 0; i < NUM_LEDS; i++) {
  3053. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3054.  
  3055.  
  3056. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3057.  
  3058. colorIndex = colorIndex + 4
  3059. ; //how fast to advance through palette 3
  3060. }
  3061. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  3062. float wavspeed = wavspeedint / 10.0;
  3063. FastLED.show();
  3064. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  3065. if (startIndex > 255) {
  3066. startIndex = 0;
  3067. }
  3068. }//end_every_n
  3069. }
  3070.  
  3071. void do_Spiral_MC_Wave_3() {
  3072. if (millis() - mil >= 10) {
  3073. mil = millis();
  3074. colorIndex = startIndex;
  3075. for ( int i = 0; i < 1; i++) {
  3076. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3077. }
  3078. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3079. for ( int i = 1; i < 7; i++) {
  3080. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3081. }
  3082. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3083. for ( int i = 7; i < 19; i++) {
  3084. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3085. }
  3086. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3087. for ( int i = 19; i < 37; i++) {
  3088. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3089. }
  3090. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3091. for ( int i = 37; i < 61; i++) {
  3092. leds[i] = ColorFromPalette( MC_p, colorIndex, 255, LINEARBLEND);
  3093. }
  3094. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3095. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  3096. float wavspeed = wavspeedint / 10.0;
  3097. FastLED.show();
  3098. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  3099. if (startIndex > 255) {
  3100. startIndex = 0;
  3101. }
  3102. }//end_every_n
  3103. }
  3104. void do_Spiral_Rainbow_Wave_1() {
  3105. if (millis() - mil >= 10) {
  3106. mil = millis();
  3107. colorIndex = startIndex;
  3108. for ( int i = 0; i < 1; i++) {
  3109. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3110.  
  3111.  
  3112. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3113.  
  3114. colorIndex = colorIndex + 1; //how fast to advance through palette 3
  3115. }
  3116. colorIndex = startIndex;
  3117. for ( int i = 1; i < 7; i++) {
  3118. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3119.  
  3120.  
  3121. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3122.  
  3123. colorIndex = colorIndex + 42; //how fast to advance through palette 3
  3124. }
  3125. for ( int i = 7; i < 19; i++) {
  3126. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3127.  
  3128.  
  3129. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3130.  
  3131. colorIndex = colorIndex + 21; //how fast to advance through palette 3
  3132. }
  3133.  
  3134. for ( int i = 19; i < 37; i++) {
  3135. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3136.  
  3137.  
  3138. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3139.  
  3140. colorIndex = colorIndex + 14; //how fast to advance through palette 3
  3141. }
  3142. colorIndex = startIndex;
  3143. for ( int i = 37; i < 61; i++) {
  3144. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3145.  
  3146.  
  3147. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3148.  
  3149. colorIndex = colorIndex + 11; //how fast to advance through palette 3
  3150. }
  3151. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  3152. float wavspeed = wavspeedint / 10.0;
  3153. FastLED.show();
  3154. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  3155. if (startIndex > 255) {
  3156. startIndex = 0;
  3157. }
  3158. }//end_every_n
  3159. }
  3160. void do_Spiral_Rainbow_Wave_2() {
  3161. if (millis() - mil >= 10) {
  3162. mil = millis();
  3163. colorIndex = startIndex;
  3164. for ( int i = 0; i < NUM_LEDS; i++) {
  3165. //ColorFromPalette( paletteName, colorIndex[0-255], brightness[0-255], blendType[NOBLEND or LINEARBLEND])
  3166.  
  3167.  
  3168. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3169.  
  3170. colorIndex = colorIndex + 4
  3171. ; //how fast to advance through palette 3
  3172. }
  3173. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  3174. float wavspeed = wavspeedint / 10.0;
  3175. FastLED.show();
  3176. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  3177. if (startIndex > 255) {
  3178. startIndex = 0;
  3179. }
  3180. }//end_every_n
  3181. }
  3182. void do_Spiral_Rainbow_Wave_3() {
  3183. if (millis() - mil >= 10) {
  3184. mil = millis();
  3185. colorIndex = startIndex;
  3186. for ( int i = 0; i < 1; i++) {
  3187. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3188. }
  3189. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3190. for ( int i = 1; i < 7; i++) {
  3191. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3192. }
  3193. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3194. for ( int i = 7; i < 19; i++) {
  3195. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3196. }
  3197. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3198. for ( int i = 19; i < 37; i++) {
  3199. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3200. }
  3201. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3202. for ( int i = 37; i < 61; i++) {
  3203. leds[i] = ColorFromPalette( RainbowColors_p, colorIndex, 255, LINEARBLEND);
  3204. }
  3205. colorIndex = colorIndex + 51; //how fast to advance through palette 3
  3206. int wavspeedint = map(anispeed, 0, 100, 2, 30);
  3207. float wavspeed = wavspeedint / 10.0;
  3208. FastLED.show();
  3209. startIndex = startIndex + wavspeed; //how fast to move the palette down the strip
  3210. if (startIndex > 255) {
  3211. startIndex = 0;
  3212. }
  3213. }//end_every_n
  3214. }
  3215. void do_MC_Fade() {
  3216. if (millis() - mil >= map(anispeed, 0, 100, 24, 1)) {
  3217. mil = millis();
  3218.  
  3219. if (P2S) {
  3220. MCFadePos++;
  3221. if (MCFadePos >= 100) {
  3222. MCFadePos = 100;
  3223. P2S = 0;
  3224. S2P = 1;
  3225. }
  3226. }
  3227. if (S2P) {
  3228. MCFadePos--;
  3229. if (MCFadePos <= 0) {
  3230. MCFadePos = 0;
  3231. P2S = 1;
  3232. S2P = 0;
  3233. }
  3234. }
  3235. fill_solid( leds, NUM_LEDS, CRGB(default_col_1.r + ((default_col_2.r - default_col_1.r) * (MCFadePos / 100.0)), default_col_1.g + ((default_col_2.g - default_col_1.g) * (MCFadePos / 100.0)), default_col_1.b + ((default_col_2.b - default_col_1.b) * (MCFadePos / 100.0)) ));
  3236. FastLED.show();
  3237.  
  3238. }
  3239. }
  3240.  
  3241. void do_Rainbow_Fade() {
  3242. if (millis() - mil >= map(anispeed, 0, 100, 24, 1)) {
  3243. mil = millis();
  3244. fill_solid( leds, NUM_LEDS, CRGB(rainbow_r, rainbow_g, rainbow_b));
  3245. FastLED.show();
  3246. if (r2b) {
  3247. rainbow_r -= rainbow_sp;
  3248. rainbow_b += rainbow_sp;
  3249. if (rainbow_r <= 0) {
  3250. r2b = 0;
  3251. b2g = 1;
  3252. rainbow_r = 0;
  3253. rainbow_b = 255;
  3254. }
  3255. }
  3256. if (b2g) {
  3257. rainbow_b -= rainbow_sp;
  3258. rainbow_g += rainbow_sp;
  3259. if (rainbow_b <= 0) {
  3260. g2r = 1;
  3261. b2g = 0;
  3262. rainbow_b = 0;
  3263. rainbow_g = 255;
  3264. }
  3265. }
  3266. if (g2r) {
  3267. rainbow_g -= rainbow_sp;
  3268. rainbow_r += rainbow_sp;
  3269. if (rainbow_g <= 0) {
  3270. g2r = 0;
  3271. r2b = 1;
  3272. rainbow_g = 0;
  3273. rainbow_r = 255;
  3274. }
  3275. }
  3276. }
  3277. }
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283. void fade(int pix, CRGB fade_from, CRGB fade_to, int per) {
  3284.  
  3285.  
  3286. leds[pix].r = fade_from.r + ((fade_to.r - fade_from.r) * (per / 100.0)) ;
  3287. leds[pix].g = fade_from.g + ((fade_to.g - fade_from.g) * (per / 100.0));
  3288. leds[pix].b = fade_from.b + ((fade_to.b - fade_from.b) * (per / 100.0));
  3289. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement