ssatovsky

xmas_brick_columns

Dec 15th, 2014
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.11 KB | None | 0 0
  1. /*
  2. Original code provided by Daniel Garcia 20141117
  3. And portions provided by Daniel Cikic 20141118
  4. Thank you both for your help :-)
  5. */
  6.  
  7. #include "FastLED.h"
  8.  
  9. #define BRIGHTNESS 192
  10. #define NUM_LEDS_PER_STRIP 70
  11. #define NUM_LEDS_LAST_STRIP 35
  12. #define NUM_STRIPS 3
  13. #define NUM_LEDS NUM_LEDS_PER_STRIP * 2 + NUM_LEDS_LAST_STRIP
  14.  
  15. #define COL_WIDTH 14
  16. #define NUM_ROWS 5
  17. CRGB leds[NUM_LEDS];
  18.  
  19. int XY(uint8_t x, uint8_t y) {
  20. // determine what column we're in
  21. uint16_t base = 0;
  22. if(x >= 14) base += NUM_LEDS_PER_STRIP;
  23. if(x >= 28) base += NUM_LEDS_PER_STRIP;
  24.  
  25. // reduce x to the position in the specific column
  26. x %= 14;
  27.  
  28. // columns B & C are wired the same
  29. if(base > 0) {
  30. if(y & 0x01) {
  31. // odd rows, reverse the ordering
  32. uint8_t rx = (COL_WIDTH - 1) - x;
  33. base += ((y*COL_WIDTH) + rx);
  34. } else {
  35. base += ((y*COL_WIDTH) + x);
  36. }
  37. } else {
  38. // column A is upside down, making this trickier
  39. uint8_t ry = (NUM_ROWS-1) - y;
  40. if(ry & 0x01) {
  41. base += ((ry*COL_WIDTH)+x);
  42. } else {
  43. uint8_t rx = (COL_WIDTH-1) -x ;
  44. base += ((ry*COL_WIDTH)+rx);
  45. }
  46. }
  47.  
  48. return base;
  49. }
  50.  
  51. // Added to allow selection of different blocks of lights 20141118
  52. byte Col1A[5][14] = {
  53. { 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56 }, // LEDs 0 to 69 Backwards because of first row
  54. { 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42 },
  55. { 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28 },
  56. { 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 },
  57. { 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }
  58. };
  59. byte Col2A[5][14] = {
  60. { 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83 }, // LEDs 70 to 139
  61. { 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 },
  62. { 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111 },
  63. { 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125 },
  64. { 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 }
  65. };
  66. byte Col3A[5][7] = {
  67. { 140, 141, 142, 143, 144, 145, 146 }, // LEDs 140 to 174
  68. { 147, 148, 149, 150, 151, 152, 153 },
  69. { 154, 155, 156, 157, 158, 159, 160 },
  70. { 161, 162, 163, 164, 165, 166, 167 },
  71. { 168, 169, 170, 171, 172, 173, 174 }
  72. };
  73.  
  74. //Added to allow lighting up each column
  75. byte Col1[1][70] = {
  76. // LEDs 0 to 69 Backwards because of first row
  77. { 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }
  78. };
  79.  
  80. byte Col2[1][70] = {
  81. // LEDs 70 to 139
  82. { 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139 }
  83. };
  84. byte Col3[1][35] = {
  85. // LEDs 140 to 174
  86. { 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174 }
  87. };
  88.  
  89. // Added to allow lighting up each row 20141203
  90. byte Rows[5][35] = {
  91. { 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 140, 141, 142, 143, 144, 145, 146 },
  92. { 147, 148, 149, 150, 151, 152, 153, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42 },
  93. { 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 154, 155, 156, 157, 158, 159, 160 },
  94. { 161, 162, 163, 164, 165, 166, 167, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 },
  95. { 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 168, 169, 170, 171, 172, 173, 174 }
  96. };
  97.  
  98. // Added to allow for Stars and Stripes
  99. byte Col1stripes[2][7] = {
  100. { 69, 67, 65, 63, 61, 59, 57 },
  101. { 42, 44, 46, 48, 50, 52, 54 }
  102. };
  103.  
  104. byte Col1stars[2][7] = {
  105. { 68, 66, 64, 62, 60, 58, 56 },
  106. { 43, 45, 47, 49, 51, 53 }
  107. };
  108.  
  109. void setup() {
  110. delay(5000); // Powerup Safely all LED devices :-)
  111. FastLED.clear(); // clear all leds
  112. FastLED.addLeds<NEOPIXEL, 10>(leds, NUM_LEDS_PER_STRIP).setDither(0);
  113. FastLED.addLeds<NEOPIXEL, 11>(leds + NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP).setDither(0);
  114. FastLED.addLeds<NEOPIXEL, 12>(leds + (2*NUM_LEDS_PER_STRIP), NUM_LEDS_LAST_STRIP).setDither(0);
  115. FastLED.setBrightness( BRIGHTNESS );
  116. // leds[NUM_LEDS] = CRGB::Black;
  117. // FastLED.delay(100);
  118. }
  119.  
  120.  
  121. void loop() {
  122. // AmerFlag1();
  123. // FastLED.delay(500);
  124.  
  125. // Test to check for multiple lights on at a time
  126. // blocksredtogreen2();
  127. // FastLED.delay(100);
  128. Rows2();
  129. FastLED.delay(50);
  130.  
  131. Columns();
  132. FastLED.delay(100);
  133. blocksredtogreen();
  134. FastLED.delay(100);
  135. blocksfiretoforest();
  136. FastLED.delay(100);
  137. blockscoraltosea();
  138. FastLED.delay(100);
  139.  
  140. // testsms();
  141. // FastLED.delay(5000);
  142. Rows1();
  143. FastLED.delay(100);
  144.  
  145. // redgreenshadow();
  146. // FastLED.delay(100);
  147. // redtogreen();
  148. // FastLED.delay(100);
  149.  
  150. redtogreen2();
  151. FastLED.delay(100);
  152.  
  153. }
  154.  
  155. void testsms() {
  156. for(int y = 0; y < NUM_ROWS; y++) {
  157. for(int x = 0; x < COL_WIDTH*NUM_STRIPS; x++ ) {
  158. leds[x] = CRGB( 255, 0, 0);
  159. leds[y] = CRGB( 0, 255, 0);
  160. FastLED.show();
  161. FastLED.delay(500);
  162. leds[x] /= 2;
  163. leds[y] *= 2;
  164. //Set to black
  165. // leds[x] = CRGB::Black;
  166. // leds[y] = CRGB::Black;
  167. // Fade to Black
  168. leds[x].fadeToBlackBy( 64 );
  169. leds[y].fadeToBlackBy( 64 );
  170. FastLED.show();
  171. FastLED.delay(500);
  172. }
  173. }
  174. }
  175.  
  176. void redtogreen() {
  177. for(int y = 0; y < NUM_ROWS; y++) {
  178. for(int x = 0; x < COL_WIDTH*NUM_STRIPS; x++ ) {
  179. leds[XY(x,y)] = CRGB::Red;
  180. leds[XY(x,y)] = CRGB::Green;
  181. FastLED.show();
  182. FastLED.delay(500);
  183. leds[XY(x,y)] = CRGB::Black;
  184. FastLED.show();
  185. }
  186. }
  187. }
  188.  
  189. void redtogreen2() {
  190. for(int y = 0; y < NUM_ROWS; y++) {
  191. for(int x = 0; x < COL_WIDTH*NUM_STRIPS; x++ ) {
  192. leds[XY(x,y)] = CRGB::Red;
  193. FastLED.show();
  194. FastLED.delay(100);
  195. leds[XY(x,y)] = CRGB::Green;
  196. FastLED.show();
  197. FastLED.delay(100);
  198. leds[XY(x,y)] = CRGB::Black;
  199. }
  200. }
  201. }
  202.  
  203. void redgreenshadow() {
  204. for(int y = 0; y < NUM_ROWS; y++) {
  205. for(int x = 0; x < COL_WIDTH*NUM_STRIPS; x++ ) {
  206. leds[XY(x,y)] = CRGB::Red;
  207. leds[XY(y,x)] = CRGB::Green;
  208. FastLED.show();
  209. FastLED.delay(500);
  210. leds[XY(x,y)] = CRGB::Black;
  211. }
  212. }
  213. }
  214.  
  215. void blocksredtogreen() {
  216. Col1AGrp(0);
  217. Col2AGrp(0);
  218. Col3AGrp(0);
  219. Col3AGrp(1);
  220. Col2AGrp(1);
  221. Col1AGrp(1);
  222. Col1AGrp(2);
  223. Col2AGrp(2);
  224. Col3AGrp(2);
  225. Col3AGrp(3);
  226. Col2AGrp(3);
  227. Col1AGrp(3);
  228. Col1AGrp(4);
  229. Col2AGrp(4);
  230. Col3AGrp(4);
  231. FastLED.delay(100);
  232. }
  233.  
  234. void blocksredtogreen2() {
  235. Col1AGrp1(0);
  236. Col2AGrp1(0);
  237. Col3AGrp1(0);
  238. Col3AGrp1(1);
  239. Col2AGrp1(1);
  240. Col1AGrp1(1);
  241. Col1AGrp1(2);
  242. Col2AGrp1(2);
  243. Col3AGrp1(2);
  244. Col3AGrp1(3);
  245. Col2AGrp1(3);
  246. Col1AGrp1(3);
  247. Col1AGrp1(4);
  248. Col2AGrp1(4);
  249. Col3AGrp1(4);
  250. FastLED.delay(100);
  251. }
  252.  
  253. void blocksfiretoforest() {
  254. Col1BGrp(0);
  255. Col2BGrp(0);
  256. Col3BGrp(0);
  257. Col3BGrp(1);
  258. Col2BGrp(1);
  259. Col1BGrp(1);
  260. Col1BGrp(2);
  261. Col2BGrp(2);
  262. Col3BGrp(2);
  263. Col3BGrp(3);
  264. Col2BGrp(3);
  265. Col1BGrp(3);
  266. Col1BGrp(4);
  267. Col2BGrp(4);
  268. Col3BGrp(4);
  269. FastLED.delay(100);
  270. }
  271.  
  272. void blockscoraltosea() {
  273. Col1CGrp(0);
  274. Col2CGrp(0);
  275. Col3CGrp(0);
  276. Col3CGrp(1);
  277. Col2CGrp(1);
  278. Col1CGrp(1);
  279. Col1CGrp(2);
  280. Col2CGrp(2);
  281. Col3CGrp(2);
  282. Col3CGrp(3);
  283. Col2CGrp(3);
  284. Col1CGrp(3);
  285. Col1CGrp(4);
  286. Col2CGrp(4);
  287. Col3CGrp(4);
  288. FastLED.delay(100);
  289. }
  290.  
  291. void AmerFlag1() {
  292. // Col1Flag(0, CRGB::Blue);
  293. // Col1Flag(1, CRGB::Blue);
  294. Col1stripesA(0, CRGB::Blue);
  295. Col1stripesA(1, CRGB::Blue);
  296. Col1starsA(0, CRGB::White);
  297. Col1starsA(1, CRGB::White);
  298. Col1Flag(2, CRGB::Red);
  299. Col1Flag(3, CRGB::White);
  300. Col1Flag(4, CRGB::Red);
  301. Col2Flag(0, CRGB::Red);
  302. Col2Flag(1, CRGB::White);
  303. Col2Flag(2, CRGB::Red);
  304. Col2Flag(3, CRGB::White);
  305. Col2Flag(4, CRGB::Red);
  306. Col3Flag(0, CRGB::Red);
  307. Col3Flag(1, CRGB::White);
  308. Col3Flag(2, CRGB::Red);
  309. Col3Flag(3, CRGB::White);
  310. Col3Flag(4, CRGB::Red);
  311. FastLED.delay(500);
  312. Col3Flag(0, CRGB::Black);
  313. Col3Flag(1, CRGB::Black);
  314. Col3Flag(2, CRGB::Black);
  315. Col3Flag(3, CRGB::Black);
  316. Col3Flag(4, CRGB::Black);
  317. Col2Flag(0, CRGB::Black);
  318. Col2Flag(1, CRGB::Black);
  319. Col2Flag(2, CRGB::Black);
  320. Col2Flag(3, CRGB::Black);
  321. Col2Flag(4, CRGB::Black);
  322. Col1Flag(2, CRGB::Black);
  323. Col1Flag(3, CRGB::Black);
  324. Col1Flag(4, CRGB::Black);
  325. Col1stripesA(0, CRGB::Black);
  326. Col1stripesA(1, CRGB::Black);
  327. Col1starsA(0, CRGB::Black);
  328. Col1starsA(1, CRGB::Black);
  329. }
  330.  
  331.  
  332. void Rows1() {
  333. rows(0, CRGB::Red);
  334. rows(1, CRGB::Green);
  335. rows(2, CRGB::Red);
  336. rows(3, CRGB::Green);
  337. rows(4, CRGB::Red);
  338. FastLED.delay(50);
  339. rows(4, CRGB::Green);
  340. rows(3, CRGB::Red);
  341. rows(2, CRGB::Green);
  342. rows(1, CRGB::Red);
  343. rows(0, CRGB::Green);
  344. FastLED.delay(100);
  345. }
  346.  
  347. void Rows2() {
  348. rows2(0);
  349. rows2(1);
  350. rows2(2);
  351. rows2(3);
  352. rows2(4);
  353. FastLED.delay(50);
  354. // rows(4, CRGB::Green);
  355. // rows(3, CRGB::Red);
  356. // rows(2, CRGB::Green);
  357. // rows(1, CRGB::Red);
  358. // rows(0, CRGB::Green);
  359. // FastLED.delay(100);
  360. }
  361.  
  362. void Columns() {
  363. column1(0, CRGB::Red);
  364. column2(0, CRGB::Green);
  365. column3(0, CRGB::Red);
  366. FastLED.delay(50);
  367. column3(0, CRGB::Green);
  368. column2(0, CRGB::Red);
  369. column1(0, CRGB::Green);
  370. FastLED.delay(100);
  371. }
  372.  
  373. // Group A
  374. void Col1AGrp(byte groupID) {
  375. for (int i = 0; i < 14; i++) {
  376. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  377. leds[Col1A[groupID][i]] = CRGB::Red;
  378. FastLED.show();
  379. FastLED.delay(150);
  380. leds[Col1A[groupID][i]] = CRGB::Green;
  381. FastLED.show();
  382. FastLED.delay(100);
  383. leds[Col1A[groupID][i]] = CRGB::Black;
  384. }
  385. }
  386. void Col2AGrp(byte groupID) {
  387. for (int i = 0; i < 14; i++) {
  388. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  389. leds[Col2A[groupID][i]] = CRGB::Green;
  390. FastLED.show();
  391. FastLED.delay(150);
  392. leds[Col2A[groupID][i]] = CRGB::Red;
  393. FastLED.show();
  394. FastLED.delay(100);
  395. leds[Col2A[groupID][i]] = CRGB::Black;
  396. }
  397. }
  398. void Col3AGrp(byte groupID) {
  399. for (int i = 0; i < 7; i++) {
  400. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  401. leds[Col3A[groupID][i]] = CRGB::Red;
  402. FastLED.show();
  403. FastLED.delay(150);
  404. leds[Col3A[groupID][i]] = CRGB::Green;
  405. FastLED.show();
  406. FastLED.delay(100);
  407. leds[Col3A[groupID][i]] = CRGB::Black;
  408. }
  409. }
  410.  
  411. // Group A2 Trying to light multiple leds at once
  412. void Col1AGrp1(byte groupID) {
  413. for (int i = 0; i < 14; i++) {
  414. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  415. leds[Col1A[groupID][i]] = CRGB::Red;
  416. FastLED.show();
  417. FastLED.delay(150);
  418. leds[Col1A[groupID][i]] = CRGB::Green;
  419. FastLED.show();
  420. FastLED.delay(100);
  421. leds[Col1A[groupID][i]] = CRGB::Black;
  422. }
  423. }
  424. void Col2AGrp1(byte groupID) {
  425. for (int i = 0; i < 14; i++) {
  426. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  427. leds[Col2A[groupID][i]] = CRGB::Green;
  428. FastLED.show();
  429. FastLED.delay(150);
  430. leds[Col2A[groupID][i]] = CRGB::Red;
  431. FastLED.show();
  432. FastLED.delay(100);
  433. leds[Col2A[groupID][i]] = CRGB::Black;
  434. }
  435. }
  436. void Col3AGrp1(byte groupID) {
  437. for (int i = 0; i < 7; i++) {
  438. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  439. leds[Col3A[groupID][i]] = CRGB::Red;
  440. FastLED.show();
  441. FastLED.delay(150);
  442. leds[Col3A[groupID][i]] = CRGB::Green;
  443. FastLED.show();
  444. FastLED.delay(100);
  445. leds[Col3A[groupID][i]] = CRGB::Black;
  446. }
  447. }
  448.  
  449. // Group B
  450. void Col1BGrp(byte groupID) {
  451. for (int i = 0; i < 14; i++) {
  452. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  453. leds[Col1A[groupID][i]] = CRGB::ForestGreen;
  454. FastLED.show();
  455. // FastLED.delay(200);
  456. // leds[Col1A[groupID][i]] = CRGB::Green;
  457. // FastLED.show();
  458. FastLED.delay(150);
  459. leds[Col1A[groupID][i]] = CRGB::Black;
  460. }
  461. }
  462. void Col2BGrp(byte groupID) {
  463. for (int i = 0; i < 14; i++) {
  464. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  465. leds[Col2A[groupID][i]] = CRGB::FireBrick;
  466. FastLED.show();
  467. // FastLED.delay(100);
  468. // leds[Col2A[groupID][i]] = CRGB::Red;
  469. // FastLED.show();
  470. FastLED.delay(150);
  471. leds[Col2A[groupID][i]] = CRGB::Black;
  472. }
  473. }
  474. void Col3BGrp(byte groupID) {
  475. for (int i = 0; i < 7; i++) {
  476. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  477. leds[Col3A[groupID][i]] = CRGB::ForestGreen;
  478. FastLED.show();
  479. // FastLED.delay(100);
  480. // leds[Col3A[groupID][i]] = CRGB::Green;
  481. // FastLED.show();
  482. FastLED.delay(150);
  483. leds[Col3A[groupID][i]] = CRGB::Black;
  484. }
  485. }
  486.  
  487. // Group C
  488. void Col1CGrp(byte groupID) {
  489. for (int i = 0; i < 14; i++) {
  490. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  491. leds[Col1A[groupID][i]] = CRGB::LightCoral;
  492. FastLED.show();
  493. // FastLED.delay(200);
  494. // leds[Col1A[groupID][i]] = CRGB::Green;
  495. // FastLED.show();
  496. FastLED.delay(150);
  497. leds[Col1A[groupID][i]] = CRGB::Black;
  498. }
  499. }
  500. void Col2CGrp(byte groupID) {
  501. for (int i = 0; i < 14; i++) {
  502. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  503. leds[Col2A[groupID][i]] = CRGB::LightSeaGreen;
  504. FastLED.show();
  505. // FastLED.delay(100);
  506. // leds[Col2A[groupID][i]] = CRGB::Red;
  507. // FastLED.show();
  508. FastLED.delay(150);
  509. leds[Col2A[groupID][i]] = CRGB::Black;
  510. }
  511. }
  512. void Col3CGrp(byte groupID) {
  513. for (int i = 0; i < 7; i++) {
  514. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  515. leds[Col3A[groupID][i]] = CRGB::LightCoral;
  516. FastLED.show();
  517. // FastLED.delay(100);
  518. // leds[Col3A[groupID][i]] = CRGB::Green;
  519. // FastLED.show();
  520. FastLED.delay(150);
  521. leds[Col3A[groupID][i]] = CRGB::Black;
  522. }
  523. }
  524.  
  525. // Rows and Columns 20141208
  526. void rows(byte groupID, uint32_t color) {
  527. for (int i = 0; i < 35; i++) {
  528. leds[Rows[groupID][i]] = color;
  529. FastLED.show();
  530. FastLED.delay(50);
  531. }
  532. for (int i = 35 - 1; i >= 0; i--) {
  533. leds[Rows[groupID][i]] = color;
  534. FastLED.show();
  535. FastLED.delay(50);
  536. leds[Rows[groupID][i]].fadeToBlackBy(15);
  537. FastLED.show();
  538. }
  539. }
  540.  
  541. // Test to try and get multiple lights on at once
  542. // void rows2(byte groupID, uint32_t color) {
  543. void rows2(byte groupID) {
  544. for (int i = 0; i < 35; i++) {
  545. leds[Rows[groupID][i]] = CRGB::Red;
  546. FastLED.show();
  547. FastLED.delay(150);
  548. leds[Rows[groupID][i]] = CRGB::Green;
  549. FastLED.show();
  550. FastLED.delay(100);
  551. // leds[Rows[groupID][i]].fadeToBlackBy( 64 );
  552. leds[Rows[groupID][i]] = CRGB::Black;
  553. // FastLED.show();
  554. // FastLED.delay(150);
  555. }
  556. /*
  557. for (int i = 35 - 1; i >= 0; i--) {
  558. leds[Rows[groupID][i]] = color;
  559. FastLED.show();
  560. FastLED.delay(50);
  561. leds[Rows[groupID][i]].fadeToBlackBy(15);
  562. FastLED.show();
  563. }
  564. */
  565. }
  566.  
  567. void column1(byte groupID, uint32_t color) {
  568. for (int i = 0; i < 70; i++) {
  569. leds[Col1[groupID][i]] = color;
  570. FastLED.show();
  571. FastLED.delay(50);
  572. }
  573. for (int i = 70 - 1; i >= 0; i--) {
  574. leds[Col1[groupID][i]] = color;
  575. FastLED.show();
  576. FastLED.delay(50);
  577. leds[Col1[groupID][i]].fadeToBlackBy(15);
  578. FastLED.show();
  579. }
  580. }
  581.  
  582. void column2(byte groupID, uint32_t color) {
  583. for (int i = 0; i < 70; i++) {
  584. leds[Col2[groupID][i]] = color;
  585. FastLED.show();
  586. FastLED.delay(50);
  587. }
  588. for (int i = 70 - 1; i >= 0; i--) {
  589. leds[Col2[groupID][i]] = color;
  590. FastLED.show();
  591. FastLED.delay(50);
  592. leds[Col2[groupID][i]].fadeToBlackBy(15);
  593. FastLED.show();
  594. }
  595. }
  596.  
  597. void column3(byte groupID, uint32_t color) {
  598. for (int i = 0; i < 35; i++) {
  599. leds[Col3[groupID][i]] = color;
  600. FastLED.show();
  601. FastLED.delay(50);
  602. }
  603. for (int i = 35 - 1; i >= 0; i--) {
  604. leds[Col3[groupID][i]] = color;
  605. FastLED.show();
  606. FastLED.delay(50);
  607. leds[Col1[groupID][i]].fadeToBlackBy(15);
  608. FastLED.show();
  609. }
  610. }
  611.  
  612. void fadetoblk(byte groupID) {
  613. for (int i = 0; i < 35; i++) {
  614. leds[Rows[groupID][i]].fadeToBlackBy(15);
  615. FastLED.show();
  616. }
  617. }
  618.  
  619. // American Flag
  620. void Col1stripesA(byte groupID, uint32_t color) {
  621. for (int i = 0; i < 7; i++) {
  622. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  623. leds[Col1stripes[groupID][i]] = color;
  624. FastLED.show();
  625. // FastLED.delay(100);
  626. // leds[Col3A[groupID][i]] = CRGB::Green;
  627. // FastLED.show();
  628. // FastLED.delay(50);
  629. // leds[Col3A[groupID][i]] = CRGB::Black;
  630. }
  631. }
  632.  
  633. void Col1starsA(byte groupID, uint32_t color) {
  634. for (int i = 0; i < 7; i++) {
  635. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  636. leds[Col1stars[groupID][i]] = color;
  637. FastLED.show();
  638. // FastLED.delay(100);
  639. // leds[Col3A[groupID][i]] = CRGB::Green;
  640. // FastLED.show();
  641. // FastLED.delay(50);
  642. // leds[Col3A[groupID][i]] = CRGB::Black;
  643. }
  644. }
  645.  
  646. void Col1Flag(byte groupID, uint32_t color) {
  647. for (int i = 0; i < 14; i++) {
  648. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  649. leds[Col1A[groupID][i]] = color;
  650. FastLED.show();
  651. // FastLED.delay(100);
  652. // leds[Col3A[groupID][i]] = CRGB::Green;
  653. // FastLED.show();
  654. // FastLED.delay(50);
  655. // leds[Col3A[groupID][i]] = CRGB::Black;
  656. }
  657. }
  658.  
  659. void Col2Flag(byte groupID, uint32_t color) {
  660. for (int i = 0; i < 14; i++) {
  661. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  662. leds[Col2A[groupID][i]] = color;
  663. FastLED.show();
  664. // FastLED.delay(100);
  665. // leds[Col3A[groupID][i]] = CRGB::Green;
  666. // FastLED.show();
  667. // FastLED.delay(50);
  668. // leds[Col3A[groupID][i]] = CRGB::Black;
  669. }
  670. }
  671.  
  672. void Col3Flag(byte groupID, uint32_t color) {
  673. for (int i = 0; i < 7; i++) {
  674. // leds[Col1A[groupID][i].setHSV(color, 255, 150);
  675. leds[Col3A[groupID][i]] = color;
  676. FastLED.show();
  677. // FastLED.delay(100);
  678. // leds[Col3A[groupID][i]] = CRGB::Green;
  679. // FastLED.show();
  680. // FastLED.delay(50);
  681. // leds[Col3A[groupID][i]] = CRGB::Black;
  682. }
  683. }
Advertisement
Add Comment
Please, Sign In to add comment