Components and supplies
Adafruit NeoPixel Digital RGB LED Strip 144 LED, 1m White
Arduino Proto Shield
Arduino UNO
Power supply 5V 10A
Connector Adapter, DC Power - 2.1mm
IR receiver (generic)
Hook Up Wire Kit, 22 AWG
Tools and machines
3D Printer (generic)
Soldering iron (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Apps and platforms
Arduino IDE
Project description
Code
The code
c_cpp
1#include <IRremote.h> 2#include <FastLED.h> 3 4 5#define LED_PIN 8 6#define NUM_LEDS 300 7 8#define ON 0xFFE01F 9#define OFF 0XFF609F 10#define WHITE 0XFFD02F 11#define RED 0XFF906F 12#define RED1 0XFFB04F 13#define RED2 0XFFA857 14#define ORANGE 0XFF9867 15#define YELLOW 0XFF8877 16#define GREEN 0XFF10EF 17#define GREEN1 0XFF30CF 18#define BLUE 0XFF50AF 19#define BLUE1 0XFF708F 20#define BLUE2 0XFF28D7 21#define BLUE3 0XFF18E7 22#define BLUE4 0XFF08F7 23#define PURPLE 0XFF6897 24#define PURPLE1 0XFF58A7 25#define PINK 0XFF48B7 26#define FLASH 0XFFF00F 27#define STROBE 0xFFE817 28#define FADE 0XFFD827 29#define smooth 0xFFC837 30#define brightnessDown 0xFF20DF 31#define brightnessUp 0xFFA05F 32 33 34int BRIGHTNESS = 255; 35#define SATURATION 255 36CRGB leds[NUM_LEDS]; 37int IRPIN = 2; 38IRrecv irrecv(IRPIN); 39decode_results result; 40int button = 0; 41bool b = true; 42int y = 0; 43int value; 44uint8_t hue = 0; 45 46int rr=252; 47int gg=0; 48int bb=0; 49CRGB led[NUM_LEDS]; 50int s=0; 51 52void setup(){ 53 FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS); 54 55 FastLED.setBrightness(BRIGHTNESS); 56 Serial.begin(9600); 57 Serial.println("Enabling IRin"); 58 irrecv.enableIRIn(); 59 Serial.println("Enabled IRin"); 60 61 62 for(int i = NUM_LEDS; i > 0; i--) { 63 leds[i] = CRGB ( 0, 0, 0); 64 FastLED.show(); 65 } 66 CHSV hsv; 67 CRGB rgb; 68 Serial.println("ready"); 69} 70 71void loop() 72{ 73 if (irrecv.decode(&result)) 74 { 75 Serial.print("Value: "); 76 Serial.println(result.value, HEX); 77 int value = result.value; 78 remoteLeds(); 79 irrecv.resume(); 80 } 81} 82void remoteLeds(){ 83 int f = 0; 84 y = 0; 85 b = true; 86 Serial.println(result.value, HEX); 87 switch(result.value){ 88 case brightnessDown: 89 if(BRIGHTNESS-50 <= 30){ 90 FastLED.setBrightness(30); 91 }else{ 92 BRIGHTNESS -= 50; 93 FastLED.setBrightness(BRIGHTNESS); 94 } 95 break; 96 case brightnessUp: 97 if(BRIGHTNESS+50 >= 255){ 98 FastLED.setBrightness(255); 99 }else{ 100 BRIGHTNESS += 50; 101 FastLED.setBrightness(BRIGHTNESS); 102 } 103 104 break; 105 case ON: 106 Serial.println("on"); 107 for(int i = NUM_LEDS; i >= 0; i--) { 108 leds[i] = CRGB ( 255, 0, 0); 109 FastLED.show(); 110 } 111 FastLED.show(); 112 break; 113 case OFF: 114 Serial.println("off"); 115 for(int i = NUM_LEDS; i >= 0; i--) { 116 leds[i] = CRGB ( 0, 0, 0); 117 FastLED.show(); 118 } 119 break; 120 case RED: 121 Serial.println("red"); 122 for(int i = NUM_LEDS; i >= 0; i--) { 123 leds[i] = CRGB (255, 0, 0); 124 FastLED.show(); 125 } 126 break; 127 case RED1: 128 Serial.println("red1"); 129 for(int i = NUM_LEDS; i >= 0; i--) { 130 leds[i] = CRGB (186,78,61); 131 FastLED.show(); 132 } 133 break; 134 case RED2: 135 Serial.println("red2"); 136 for(int i = NUM_LEDS; i >= 0; i--) { 137 leds[i] = CRGB (167,74,54); 138 FastLED.show(); 139 } 140 break; 141 case ORANGE: 142 Serial.println("orange"); 143 for(int i = NUM_LEDS; i >= 0; i--) { 144 leds[i] = CRGB (255,69,0); 145 FastLED.show(); 146 } 147 break; 148 case YELLOW: 149 Serial.println("yellow"); 150 for(int i = NUM_LEDS; i >= 0; i--) { 151 leds[i] = CRGB (255,255,0); 152 FastLED.show(); 153 } 154 break; 155 case GREEN: 156 Serial.println("green"); 157 for(int i = NUM_LEDS; i >= 0; i--) { 158 leds[i] = CRGB (0,255,0); 159 FastLED.show(); 160 } 161 break; 162 case GREEN1: 163 Serial.println("green1"); 164 for(int i = NUM_LEDS; i >= 0; i--) { 165 leds[i] = CRGB (36,87,54); 166 FastLED.show(); 167 } 168 break; 169 case BLUE: 170 Serial.println("blue"); 171 for(int i = NUM_LEDS; i >= 0; i--) { 172 leds[i] = CRGB (0,0,255); 173 FastLED.show(); 174 } 175 break; 176 case BLUE1: 177 Serial.println("blue1"); 178 for(int i = NUM_LEDS; i >= 0; i--) { 179 leds[i] = CRGB (38,61,91); 180 FastLED.show(); 181 } 182 break; 183 case BLUE2: 184 Serial.println("blue2"); 185 for(int i = NUM_LEDS; i >= 0; i--) { 186 leds[i] = CRGB (38,61,91); 187 FastLED.show(); 188 } 189 break; 190 case BLUE3: 191 Serial.println("blue3"); 192 for(int i = NUM_LEDS; i >= 0; i--) { 193 leds[i] = CRGB (15,51,73); 194 FastLED.show(); 195 } 196 break; 197 case BLUE4: 198 Serial.println("blue4"); 199 for(int i = NUM_LEDS; i >= 0; i--) { 200 leds[i] = CRGB (15,51,73); 201 FastLED.show(); 202 } 203 break; 204 case PURPLE: 205 Serial.println("purple"); 206 for(int i = NUM_LEDS; i >= 0; i--) { 207 leds[i] = CRGB (239,0,139); 208 FastLED.show(); 209 } 210 break; 211 case PURPLE1: 212 Serial.println("purple1"); 213 for(int i = NUM_LEDS; i > 0; i--) { 214 leds[i] = CRGB (239,0,170); 215 FastLED.show(); 216 } 217 break; 218 case PINK: 219 Serial.println("pink"); 220 for(int i = NUM_LEDS; i >= 0; i--) { 221 leds[i] = CRGB (255, 182, 193); 222 FastLED.show(); 223 } 224 break; 225 case WHITE: 226 Serial.println("white"); 227 for(int i = NUM_LEDS; i >= 0; i--) { 228 leds[i] = CRGB (255,255,255); 229 FastLED.show(); 230 } 231 break; 232 case FLASH: 233 while(1){ 234 flashs: 235 if(b){ 236 for(int i = NUM_LEDS; i >= 0; i--) { 237 leds[i] = CRGB (255, 0, 0); 238 FastLED.show(); 239 delay(40); 240 if (irrecv.decode(&result)) { 241 f++; 242 if (f > 1){ 243 Serial.println("broke from flash"); 244 b = false; 245 goto flashs; 246 } 247 irrecv.resume(); 248 } 249 } 250 delay(1000); 251 for(int i = NUM_LEDS; i >= 0; i--) { 252 leds[i] = CRGB (186,78,61); 253 FastLED.show(); 254 delay(40); 255 if (irrecv.decode(&result)) { 256 f++; 257 if (f > 1){ 258 Serial.println("broke from flash"); 259 b = false; 260 goto flashs; 261 } 262 irrecv.resume(); 263 } 264 } 265 delay(1000); 266 for(int i = NUM_LEDS; i >= 0; i--) { 267 leds[i] = CRGB (167,74,54); 268 FastLED.show(); 269 delay(40); 270 if (irrecv.decode(&result)) { 271 f++; 272 if (f > 1){ 273 Serial.println("broke from flash"); 274 b = false; 275 goto flashs; 276 } 277 irrecv.resume(); 278 } 279 } 280 delay(1000); 281 for(int i = NUM_LEDS; i >= 0; i--) { 282 leds[i] = CRGB (255,69,0); 283 FastLED.show(); 284 delay(40); 285 if (irrecv.decode(&result)) { 286 f++; 287 if (f > 1){ 288 Serial.println("broke from flash"); 289 b = false; 290 goto flashs; 291 } 292 irrecv.resume(); 293 } 294 } 295 delay(1000); 296 for(int i = NUM_LEDS; i >= 0; i--) { 297 leds[i] = CRGB (255,255,0); 298 FastLED.show(); 299 delay(40); 300 if (irrecv.decode(&result)) { 301 f++; 302 if (f > 1){ 303 Serial.println("broke from flash"); 304 b = false; 305 goto flashs; 306 } 307 irrecv.resume(); 308 } 309 } 310 delay(1000); 311 for(int i = NUM_LEDS; i >= 0; i--) { 312 leds[i] = CRGB (0,255,0); 313 FastLED.show(); 314 delay(40); 315 if (irrecv.decode(&result)) { 316 f++; 317 if (f > 1){ 318 Serial.println("broke from flash"); 319 b = false; 320 goto flashs; 321 } 322 irrecv.resume(); 323 } 324 } 325 delay(1000); 326 for(int i = NUM_LEDS; i >= 0; i--) { 327 leds[i] = CRGB (36,87,54); 328 FastLED.show(); 329 delay(40); 330 if (irrecv.decode(&result)) { 331 f++; 332 if (f > 1){ 333 Serial.println("broke from flash"); 334 b = false; 335 goto flashs; 336 } 337 irrecv.resume(); 338 } 339 } 340 341 for(int i = NUM_LEDS; i >= 0; i--) { 342 leds[i] = CRGB (0,0,255); 343 FastLED.show(); 344 delay(40); 345 if (irrecv.decode(&result)) { 346 f++; 347 if (f > 1){ 348 Serial.println("broke from flash"); 349 b = false; 350 goto flashs; 351 } 352 irrecv.resume(); 353 } 354 } 355 356 for(int i = NUM_LEDS; i >= 0; i--) { 357 leds[i] = CRGB (38,61,91); 358 FastLED.show(); 359 delay(40); 360 if (irrecv.decode(&result)) { 361 f++; 362 if (f > 1){ 363 Serial.println("broke from flash"); 364 b = false; 365 goto flashs; 366 } 367 irrecv.resume(); 368 } 369 } 370 371 for(int i = NUM_LEDS; i >= 0; i--) { 372 leds[i] = CRGB (38,61,91); 373 FastLED.show(); 374 delay(40); 375 if (irrecv.decode(&result)) { 376 f++; 377 if (f > 1){ 378 Serial.println("broke from flash"); 379 b = false; 380 goto flashs; 381 } 382 irrecv.resume(); 383 } 384 } 385 for(int i = NUM_LEDS; i >= 0; i--) { 386 leds[i] = CRGB (15,51,73); 387 FastLED.show(); 388 delay(40); 389 if (irrecv.decode(&result)) { 390 f++; 391 if (f > 1){ 392 Serial.println("broke from flash"); 393 b = false; 394 goto flashs; 395 } 396 irrecv.resume(); 397 } 398 } 399 400 for(int i = NUM_LEDS; i >= 0; i--) { 401 leds[i] = CRGB (15,51,73); 402 FastLED.show(); 403 delay(40); 404 if (irrecv.decode(&result)) { 405 f++; 406 if (f > 1){ 407 Serial.println("broke from flash"); 408 b = false; 409 goto flashs; 410 } 411 irrecv.resume(); 412 } 413 } 414 415 for(int i = NUM_LEDS; i >= 0; i--) { 416 leds[i] = CRGB (239,0,139); 417 FastLED.show(); 418 delay(40); 419 if (irrecv.decode(&result)) { 420 f++; 421 if (f > 1){ 422 Serial.println("broke from flash"); 423 b = false; 424 goto flashs; 425 } 426 irrecv.resume(); 427 } 428 } 429 430 for(int i = NUM_LEDS; i >= 0; i--) { 431 leds[i] = CRGB (128,0,128); 432 FastLED.show(); 433 delay(40); 434 if (irrecv.decode(&result)) { 435 f++; 436 if (f > 1){ 437 Serial.println("broke from flash"); 438 b = false; 439 goto flashs; 440 } 441 irrecv.resume(); 442 } 443 } 444 445 for(int i = NUM_LEDS; i >= 0; i--) { 446 leds[i] = CRGB (255, 182, 193); 447 FastLED.show(); 448 delay(40); 449 if (irrecv.decode(&result)) { 450 f++; 451 if (f > 1){ 452 Serial.println("broke from flash"); 453 b = false; 454 goto flashs; 455 } 456 irrecv.resume(); 457 } 458 } 459 for(int i = NUM_LEDS; i >= 0; i--) { 460 leds[i] = CRGB (255,255,255); 461 FastLED.show(); 462 delay(40); 463 if (irrecv.decode(&result)) { 464 f++; 465 if (f > 1){ 466 Serial.println(result.value,HEX); 467 Serial.println("broke from flash"); 468 b = false; 469 goto flashs; 470 } 471 irrecv.resume(); 472 } 473 } 474 }else{ 475 break; 476 } 477 } 478 case STROBE: 479 while(1){ 480 STROBES: 481 482 if(b){ 483 for(int i = NUM_LEDS; i >= 0; i--) { 484 leds[i] = CHSV(random8(),255,255); 485 if(i+20 > NUM_LEDS){ 486 487 }else{ 488 leds[i+20] = CHSV(random8(),255,255); 489 FastLED.show(); 490 } 491 492 delay(40); 493 if (irrecv.decode(&result)) { 494 f++; 495 if (f > 1){ 496 Serial.println(result.value,HEX); 497 Serial.println("broke from strobe"); 498 b = false; 499 goto STROBES; 500 } 501 irrecv.resume(); 502 } 503 } 504 }else{ 505 break; 506 } 507 } 508 case FADE: 509 while(1){ 510 FADES: 511 int r1 = random(0,255); 512 int g1 = random(0,255); 513 int b1 = random(0,255); 514 int r2 = random(0,255); 515 int g2 = random(0,255); 516 int b2 = random(0,255); 517 int r3 = random(0,255); 518 int g3 = random(0,255); 519 int b3 = random(0,255); 520 int r4 = random(0,255); 521 int g4 = random(0,255); 522 int b4 = random(0,255); 523 int r5 = random(0,255); 524 int g5 = random(0,255); 525 int b5 = random(0,255); 526 int r6 = random(0,255); 527 int g6 = random(0,255); 528 int b6 = random(0,255); 529 int r7 = random(0,255); 530 int g7 = random(0,255); 531 int b7 = random(0,255); 532 int r8 = random(0,255); 533 int g8 = random(0,255); 534 int b8 = random(0,255); 535 int r9 = random(0,255); 536 int g9 = random(0,255); 537 int b9 = random(0,255); 538 int r10 = random(0,255); 539 int g10 = random(0,255); 540 int b10 = random(0,255); 541 if(b){ 542 for(int i = NUM_LEDS; i >= 0; i--) { 543 leds[i] = CRGB (r1,g1,b1); 544 if(i+20 > NUM_LEDS){ 545 // nothing 546 }else{ 547 leds[i+20] = CRGB (r2,g2,b2); 548 FastLED.show(); 549 } 550 if(i-20 < 0){ 551 // nothing 552 }else{ 553 leds[i-20] = CRGB (r3,g3,b3); 554 FastLED.show(); 555 } 556 if(i+50 > NUM_LEDS){ 557 // nothing 558 }else{ 559 leds[i+50] = CRGB (r4,g4,b4); 560 FastLED.show(); 561 } 562 if(i-60 < 0){ 563 // nothing 564 }else{ 565 leds[i-50] = CRGB (r5,g5,b5); 566 FastLED.show(); 567 } 568 if(i-90 < 0){ 569 // nothing 570 }else{ 571 leds[i-90] = CRGB (r6,g6,b6); 572 FastLED.show(); 573 } 574 if(i-120 < 0){ 575 // nothing 576 }else{ 577 leds[i-120] = CRGB (r7,g7,b7); 578 FastLED.show(); 579 } 580 if(i-180 < 0){ 581 // nothing 582 }else{ 583 leds[i-180] = CRGB (r8,g8,b8); 584 FastLED.show(); 585 } 586 if(i-220 < 0){ 587 // nothing 588 }else{ 589 leds[i-220] = CRGB (r9,g9,b9); 590 FastLED.show(); 591 } 592 if(i-260 < 0){ 593 // nothing 594 }else{ 595 leds[i-260] = CRGB (r10,g10,b10); 596 FastLED.show(); 597 } 598 599 delay(40); 600 if (irrecv.decode(&result)) { 601 f++; 602 if (f > 1){ 603 Serial.println(result.value,HEX); 604 Serial.println("broke from fade"); 605 b = false; 606 goto FADES; 607 } 608 irrecv.resume(); 609 } 610 } 611 }else{ 612 break; 613 } 614 } 615 case smooth: 616 Serial.println("smooth"); 617 while(1){ 618 SMOOTH: 619 if(b){ 620 for (int j = 0; j < 255; j++) { 621 for (int i = 0; i < NUM_LEDS; i++) { 622 leds[i] = CHSV(i - (j * 2), SATURATION, BRIGHTNESS); 623 } 624 FastLED.show(); 625 delay(25); 626 if (irrecv.decode(&result)) { 627 f++; 628 if (f > 1){ 629 Serial.println(result.value,HEX); 630 Serial.println("broke from SMOOTH"); 631 b = false; 632 goto SMOOTH; 633 } 634 irrecv.resume(); 635 636 } 637 } 638 }else{ 639 break; 640 } 641 } 642 break; 643 } 644}
Downloadable files
Schematic
Schematic
Schematics
https://github.com/dzh121/Remote-lights/blob/main/Schematics/led%20strip.fzz
Box
https://github.com/dzh121/Remote-lights/blob/main/Schematics/led%20box.stl
Cover
https://github.com/dzh121/Remote-lights/blob/main/Schematics/led%20box%20cover.stl
Comments
Only logged in users can leave comments
dzh121
0 Followers
•0 Projects
Table of contents
Intro
0
0