Instructables

Led Slot Machine Costume

Featured
Picture of Led Slot Machine Costume
IMG_3059.JPG
This Instructable will walk you through my process of making a Slot Machine costume with addressable leds controlled with an arduino!



 
Remove these adsRemove these ads by Signing Up

Step 2: Lets Get started

Picture set up:


I found my slot picture online that the best graphic that when enlarged would stay nice and clear. Be sure to follow the directions on the iron on transfer paper when printing and transferring. Print the picture to full page 8.5 by 11 HINT: Turn off border less printing or it will cut off part of the pic. I forgot and end cut part off the pic. 

Lay out the transfer paper and mark the edges with pins ( see pic 1 )  and check to be sure it is centered. Once you are happy with the lay out you can go ahead and lay the transfer back down and remove the pins. 

Start the transfer process following the iron on transfer instructions. Let it cool completely before attempting to remove. If you notice the transfer not bonding as you lift , reheat it until it bonds.




Light holders:  


We need a way for the addressable leds to stay in place. I chose to use Heat-N-Bond with some extra fabric. 

Cut fabric strips about 2 1/2" wide and 2" longer then each side ( you should end up with 4 strips for all sides) (See Pic 2)

Cut the Heat-N-Bond to the size of the strips and attach following the instructions provided with the package. (See Pic 3)

Cut some more fabric strips to 1 1/2" wide by as long as the other strips you just made. (See Pic 4)

Cut 2" by 2" fabric squares and iron them to the ends of the strips. (See Pic 5)

           Attach the light holder strips:

Turn the shirt inside out and position the 1 1/2" (See pic 4a ) strips along the picture outline. Peal the backing off the Heat-N-Bond of the wider strips and lay facing down on top of small strips being sure it is centered.  (See pic 4b)

Iron on following the instructions provided in package.

You should now have long pockets along the perimeter of the picture with 2" ends that can be lifted ( these will later be used for access to solder the lights then bonded down)  (See pic 6)


 





 

Step 3: Moving On to the next phase

Picture of Moving On to the next phase
IMG_3070.JPG
IMG_3071.JPG
Adding the lights:


Cut the light strips so there is 6 leds on two strips and 10 leds on two more strips ( 4 strips total)

Insert the two longer strips into the bottom and top of the light holders (see pic A) Making sure to keep track of  the in and out of each section.
Then insert the other two strips.

Place some foil under the end of the strip so you don't burn the shirt while soldering. These can be soldered on the front or the back either way will do. But be sure to keep track of the 5v+, 5v-, DI, CI lines they must match. It is important that the out put end connects to the input line!! (See Pic B)

Leave one end unconnected (I chose bottom right) The end of the short strip can be left untouched, However the longer bottom strip with the input will need some pins soldered. ( See Pic C)


TESTING!!  Must test before closing up fabric ends. 

Load the arduino sketch and connect to make sure all lights and connections are in working order.

Connect the Di of the led strip to arduino pin 11
Connect the Ci of the led strip to arduino pin 13
Connect the -5V of the led strip to arduino ground
Connect the +5v of the led strop to arduino +5v



Close it all up:

Once you have determined all is working we can now close up the extra fabric flaps. Lay them all flat and determine if there is any extra you want to trim. Cut a slit where the pins will protrude from and mark the the - and +( See pic D) 

Now cut some small strip of Heat-N-bond and iron it the the shirt just under the flaps, peal the backing and lay the fabric flap over and iron.  ( See pic E for finished look)

Attach cable of choice again be sure to keep track of the wire layout. 







Step 4: The enclosure

For the enclosure I used a plastic box I had laying around and It fit just right. An altoids tin will work just as well. 

Connect some wire to four pins and make a small hole in the side of the enclosure (See pic A1) On the inside of the enclosure slit the wire so you have 2 sets of 2 . Take 2 pins and bend at a 90o angle and solder the +5v and -5v to these. Next take 3pins beld at a 90o angle and solder the Di and Ci wires to each end. 


Batteries:

I used a battery holder for 4 AA's it has two wires and a switch. Chose the location of the battery holder and cut a small hole for the switch. Connect 2 pins bet at a 90o angle and solder to the end. ( These will connect to the VIN and gnd on the arduino


The enclosure is now complete!!

Step 5: Hat Light

Picture of Hat Light
Building the hat light:

Start heating up the glue gun:

Build the flashing led kit. Then remove  the covers from 2 nightlights and trace the outline from the bottom of the covers on a piece of cardboard (this will separate and hold the led kit in place). (pic C1)
The cardboard will need to be trimmed a bit more as needed so as it holds it in the center. (pic C2)

Hold one nightlight on the front of the hat with the washer inside on the bottom slightly to one side of the center of the hat and place some glue in the center of the washer and hold till it dries. Remove the light cover and repeat for the second washer. (pic C3) 

Now assemble the light with the cardboard and flasher kit inside under both washers and place a piece of clear tape over the seam.(pic C4)     Make a small hole in the hat by the seam of the brim and face to run the wire inside. Now on the inside add a switch and battery clip.(pic C5, C6)     Glue the switch behind the sweat band so it can easily be reached. Glue the 9V batt to the side of the hat where it will be comfortable. I chose the the top front where the hat sticks out the most.  



Step 6: Code And Video






#include "LPD8806.h"
#include

// Example to control LPD8806-based RGB LED Modules in a strip
//digital in pin 11
//clock in pin 13
/*****************************************************************************/



// The LED strips are 32 LEDs per meter but you can extend/cut the strip


LPD8806 strip = LPD8806(32); // Set the first variable to the NUMBER of pixels. 32 = 32 pixels in a row

void setup() {
  // Start up the LED strip
  strip.begin();

  // Update the strip, to start they are all 'off'
  strip.show();
}


void loop() {

  randomSparkleUpSegment(strip.Color(25,0,0),15,10,101,152); //color, density, delay, low point, high point
  turnSegmentOn(strip.Color(25,0,0),1000, 101, 152); //color, delay, start of segment, end of segment
  randomSparkleUpSegment(strip.Color(0,25,0),15,10,0,100); //color, density, delay, low point, high point
  turnSegmentOn(strip.Color(0,25,0),200,0,100); //color, delay, start of segment, end of segment
  delay(500);
  turnAllOff;
  fillUpTheStar(strip.Color(0,0,25),30); //color, delay
  fillUpCenterStar(strip.Color(0,0,25),30); //color, delay
  fillUpTheStar(strip.Color(25,0,0),30); //color, delay
  fillUpCenterStar(strip.Color(25,0,0),30); //color, delay
  fillUpTheStar(strip.Color(0,25,0),30); //color, delay
  fillUpCenterStar(strip.Color(0,25,0),30); //color, delay
  fillUpTheStar(strip.Color(25,25,25),30); //color, delay
  fillUpCenterStar(strip.Color(25,25,25),30); //color, delay
 
  turnAllOn(strip.Color(25,0,0),200); //color, delay - turn all pixels one color
  dither(strip.Color(0,25,0), 50); //color, delay - random fills up the strip
  fadeDown(0,25,0,30); //red, green, blue, delay - fade down all pixels one color
  dither(strip.Color(25,0,0), 50); //color, delay - random fills up the strip
  fadeDown(25,0,0,30); //red, green, blue, delay - fade down all pixels one color
   
  turnAllOn(strip.Color(25,0,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(0,25,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(25,0,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(0,25,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(25,0,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(0,25,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(25,0,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(0,25,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(25,0,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(0,25,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(25,0,0),400); //color, delay - turn all pixels one color
  turnAllOn(strip.Color(0,25,0),400); //color, delay - turn all pixels one color
  chaseBetweenLToH(strip.Color(25,25,25),20,0,100); //color, delay, low, high - chase led between two locations progressing up the chain
  chaseBetweenHToL(strip.Color(25,25,25),20,103,152); //color, delay, low, high - chase led between two locations progressing down the chain
 
  turnAllOff(); //turn all pixels off
  fadeUp(25,0,0,20); //red, green, blue, delay - fade up all pixels one color
  fadeDown(25,0,0,20); //red, green, blue, delay - fade down all pixels one color
  fadeUp(0,25,0,20); //red, green, blue, delay - fade up all pixels one color
  fadeDown(0,25,0,20); //red, green, blue, delay - fade down all pixels one color
  turnAllOff();
 
  /// strobe effect r/g rg
  randomSparkle(strip.Color(25,0,0),20, 30); //color, density, delay - random sparkles in one color
  randomSparkle(strip.Color(0,25,0),20, 30); //color, density, delay - random sparkles in one color
  twoColorSparkle(strip.Color(25,0,0), strip.Color(0,25,0), 20, 10); //color 1, color 2, density, delay - random sparkles in two colors

  rainbow(20);
  turnAllOff();

  randomColorSparkle(30); //delay - random color sparkles
 
  turnAllOn(strip.Color(0,0,25),1000); //color, delay - turn all pixels one color
  chaseBetweenLToH(strip.Color(25,25,25),1,0,159); //color, delay, low, high - chase leds between two locations progressing up the chain
  chaseBetweenLToH(strip.Color(0,25,0),0,0,159); //color, delay, low, high - chase leds between two locations progressing up the chain
  chaseBetweenHToL(strip.Color(25,0,0),0,0,159); //color, delay, low, high - chase leds between two locations progressing down the chain
  chaseBetweenHToL(strip.Color(0,25,0),0,0,159); //color, delay, low, high - chase leds between two locations progressing down the chain
  chaseToCenter(strip.Color(25,0,0),25,1,0,159); //color, number of leds in line, delay, low, high - chase lines to the center
  chasePastCenter(strip.Color(25,0,0),25,1,0,159); //color, number of leds in line, delay, low, high - chase lines past the center
  chaseBetweenLToH(strip.Color(50,50,25),1,0,159); //color, delay, low, high - chase leds between two locations progressing up the chain
  chaseBetweenLToH(strip.Color(25,0,0),0,0,159); //color, delay, low, high - chase leds between two locations progressing up the chain
  chaseBetweenLToH(strip.Color(0,25,0),0,0,159); //color, delay, low, high - chase leds between two locations progressing up the chain
  chaseLineHToL(strip.Color(25,0,0),50,0,0,159); //color, number of leds in line, delay, low, high - chase leds in a line progressing up the chain
  chaseLineLToH(strip.Color(0,25,0),50,0,0,159); //color, delay, low, high - chase leds between two locations progressing up the chain
 
  rainbowCycle(0);  // make it go through the cycle fairly fast
  turnAllOff();
 
  //red and green segments around perimeter, center blue
  int i;
  for(i=1; i<=4; i++){

  delay(1000);
  fadeDown(25,25,25,40); //red, green, blue, delay - fade down all pixels one color
  }
 
  turnAllOn(strip.Color(0,0,25),200);
  dither(strip.Color(25,0,0), 20); //color, delay - random fills up the strip
  fadeDown(25,0,0,30); //red, green, blue, delay - fade down all pixels one color
 
  turnSegmentOn(strip.Color(0,0,25),10,104,159); //color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,0,25),10,0,103); //color, delay, start of segment, end of segment  
  chaseUpTheStar(strip.Color(25,0,0),30); //color, delay
  chaseUpCenterStar(strip.Color(25,0,0),30); //color, delay
  turnSegmentOn(strip.Color(0,25,0),10,0,159); //color, delay, start of segment, end of segment
  chaseUpTheStar(strip.Color(25,0,0),30); //color, delay
  turnAllOff();
 
  fillUpTheStar(strip.Color(25,0,0),30); //color, delay
  fillUpCenterStar(strip.Color(0,25,0), 30); //color, delay
  fillUpTheStar(strip.Color(0,25,0),30); //color, delay
  fillUpCenterStar(strip.Color(25,0,0),30); //color, delay
  fillUpTheStar(strip.Color(25,25,25),30); //color, delay
  fillUpCenterStar(strip.Color(25,25,25),30); //color, delay
 
  turnAllOff();
  dither(strip.Color(0,25,25), 10); //color, delay - random fills up the strip
  fadeDown(0,25,25,20); //red, green, blue, delay - fade down all pixels one color
  turnAllOff();
  scanner(25,0,0,10); //red, green, blue, delay                             
  turnAllOff();
  wave(strip.Color(25,0,0),5,0,200); //color, cycles, delay, repetitions
  fadeDown(25,0,0,20); //red, green, blue, delay - fade down all pixels one color
  wave(strip.Color(0,25,0),5,0,200); //color, cycles, delay, repetitions
  turnAllOff();
 
 
  randomSparkleUpStrip(strip.Color(25,25,25),15,10); //color, density, wait
  turnAllOn(strip.Color(25,25,25),500);
  fadeDown(25,25,25,20); //red, green, blue, delay - fade down all pixels one color
  randomSparkleUpStrip(strip.Color(20,20,25),15,10);
  turnAllOn(strip.Color(20,20,25),500);
  fadeDown(20,20,25,20); //red, green, blue, delay - fade down all pixels one color
  randomSparkleUpStrip(strip.Color(25,50,25),15,10);
  turnAllOn(strip.Color(25,50,25),500);
  fadeDown(25,50,25,20); //red, green, blue, delay - fade down all pixels one color
  randomSparkleUpStrip(strip.Color(20,25,39),15,10);
  turnAllOn(strip.Color(20,127,39),500);
  fadeDown(20,25,39,20); //red, green, blue, delay - fade down all pixels one color
  randomSparkleUpStrip(strip.Color(10,10,25),15,10);
  turnAllOn(strip.Color(10,10,25),500);
  fadeDown(10,10,25,20); //red, green, blue, delay - fade down all pixels one color

  turnAllOn(strip.Color(0,25,0),400);
  chaseBetweenLToH(strip.Color(25,0,0),20,0,100); //color, delay, low, high - chase led between two locations progressing up the chain
  chaseBetweenHToL(strip.Color(25,0,0),20,103,152); //color, delay, low, high - chase led between two locations progressing down the chain

//green to red wave                                                             
  wave(strip.Color(0,25,0),5,0,100); //color, cycles, delay, repetitions
  wave(strip.Color(20,25,0),10,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(40,25,0),15,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(80,25,0),20,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(25,25,0),25,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(25,80,0),35,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(25,40,0),35,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(25,20,0),35,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(25,0,0),35,0,100); //color, cycles, delay, repetitions
  wave(strip.Color(25,0,0),35,0,50); //color, cycles, delay, repetitions
 
  turnAllOff();

  wave(strip.Color(0,25,0),35,0,100); //color, cycles, delay, repetitions
  wave(strip.Color(20,107,0),35,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(40,87,0),35,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(80,47,0),30,0,50); //color, cycles, delay, repetitions
  wave(strip.Color(107,27,0),20,0,100); //color, cycles, delay, repetitions
  wave(strip.Color(25,0,0),5,0,200); //color, cycles, delay, repetitions
 


  int j;
  for(j=1; j<=15; j++){
  turnSegmentOn(strip.Color(0,0,25),0, 60, 100);//red 1 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,0,0),0, 147, 152); //blue 1 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,0,0),200, 103, 109); //blue 1 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,25,0),0, 44, 59); //red 4 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,25,0),0, 110, 121); //blue 4 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,0,25),0, 0, 15); //red 2 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,0,0),200, 135, 146); //blue 2 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,25,0),0, 60, 100); //red 1 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,25,0),0, 147, 152); // blue 1 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,25,0),0, 103, 109); //blue 1 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,0,25),0, 16, 43); //red 3 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,0,0),200, 122, 134); //blue 3 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,25,0),0, 0, 15); //red 2 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,25,0),0, 135, 146); //blue 2 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,0,25),0, 44, 59); //red 4 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,0,0),200, 110, 121); //blue 4 on - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(25,25,0),0, 16, 43); //red 3 off - color, delay, start of segment, end of segment
  turnSegmentOn(strip.Color(0,25,0),0, 122, 134); //blue 3 off - color, delay, start of segment, end of segment
  }
 

 
  chaseMultipleLinesLToH(10,10,0,152); //number of leds in line, delay, low, high - chase multiple lines progressing up the chain


}

// An "ordered dither" fills every pixel in a sequence that looks
// sparkly and almost random, but actually follows a specific order.
void dither(uint32_t c, uint8_t wait) {
  // Determine highest bit needed to represent pixel index
  int hiBit = 0;
  int n = strip.numPixels() - 1;
  for(int bit=1; bit < 0x8000; bit <<= 1) {
    if(n & bit) hiBit = bit;
  }
  int bit, reverse;
  for(int i=0; i<(hiBit << 1); i++) {
    // Reverse the bits in i to create ordered dither:
    reverse = 0;
    for(bit=1; bit <= hiBit; bit <<= 1) {
      reverse <<= 1;
      if(i & bit) reverse |= 1;
    }
    strip.setPixelColor(reverse, c);
    strip.show();
    delay(wait);
  }
  delay(250); // Hold image for 1/4 sec
}

// "Larson scanner" = Cylon/KITT bouncing light effect
void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait) {
  int i, j, pos, dir;
  pos = 0;
  dir = 1;
  for(i=0; i<((strip.numPixels()-1) * 8); i++) {
    // Draw 5 pixels centered on pos. setPixelColor() will clip
    // any pixels off the ends of the strip, no worries there.
    // we'll make the colors dimmer at the edges for a nice pulse
    // look
    strip.setPixelColor(pos - 2, strip.Color(r/4, g/4, b/4));
    strip.setPixelColor(pos - 1, strip.Color(r/2, g/2, b/2));
    strip.setPixelColor(pos, strip.Color(r, g, b));
    strip.setPixelColor(pos + 1, strip.Color(r/2, g/2, b/2));
    strip.setPixelColor(pos + 2, strip.Color(r/4, g/4, b/4));

    strip.show();
    delay(wait);
    // If we wanted to be sneaky we could erase just the tail end
    // pixel, but it's much easier just to erase the whole thing
    // and draw a new one next time.
    for(j=-2; j<= 2; j++)
        strip.setPixelColor(pos+j, strip.Color(0,0,0));
    // Bounce off ends of strip
    pos += dir;
    if(pos < 0) {
      pos = 1;
      dir = -dir;
    } else if(pos >= strip.numPixels()) {
      pos = strip.numPixels() - 2;
      dir = -dir;
    }
  }
}

// Sine wave effect
#define PI 3.14159265
void wave(uint32_t c, int cycles, uint8_t wait, int repetitions) {
  float y;
  byte r, g, b, r2, g2, b2;
  // Need to decompose color into its r, g, b elements
  g = (c >> 16) & 0x7f;
  r = (c >> 8) & 0x7f;
  b = c & 0x7f;
  for(int x=0; x   {
    for(int i=0; i       y = sin(PI * (float)cycles * (float)(x + i) / (float)strip.numPixels());
        y = 1.0 - y; // Translate Y to 0.0 (top) to 1.0 (center)
        r2 = (byte)((float)r * y);
        g2 = (byte)((float)g * y);
        b2 = (byte)((float)b * y);
     
      strip.setPixelColor(i, r2, g2, b2);
    }
    strip.show();
    delay(wait);
  }
}

void chaseUpTheStar(uint32_t c, uint8_t wait) {
  int i,j;
      strip.setPixelColor(80, c);
      delay(wait);
      strip.setPixelColor(80, strip.Color(0,0,0));
         for (i = 1; i <= 20; i++) {
           strip.setPixelColor(80+i, c);
           strip.setPixelColor(80-i, c);
           strip.show();   // write all the pixels out
           delay(wait);
           strip.setPixelColor(80+i, strip.Color(0,0,0));
           strip.setPixelColor(80-i, strip.Color(0,0,0));
           strip.show();   // write all the pixels out
         }
         for (j=0; j<=29; j++) {
           strip.setPixelColor(j, c);
           strip.setPixelColor(59-j, c);
           strip.show();   // write all the pixels out
           delay(wait);
           strip.setPixelColor(j, strip.Color(0,0,0));
           strip.setPixelColor(59-j, strip.Color(0,0,0));
           strip.show();   // write all the pixels out
         } 
}

void chaseUpCenterStar(uint32_t c, uint8_t wait) {
  int i,j;
         for (i = 1; i <= 6; i++) {
           strip.setPixelColor(146+i, c);
           strip.setPixelColor(147-i, c);
           strip.show();   // write all the pixels out
           delay(wait);
           strip.setPixelColor(146+i, strip.Color(0,0,0));
           strip.setPixelColor(147-i, strip.Color(0,0,0));
           strip.show();   // write all the pixels out
         }
         for (j=0; j<=18; j++) {
           strip.setPixelColor(103+j, c);
           strip.setPixelColor(140-j, c);
           strip.show();   // write all the pixels out
           delay(wait);
           strip.setPixelColor(103+j, strip.Color(0,0,0));
           strip.setPixelColor(140-j, strip.Color(0,0,0));
           strip.show();   // write all the pixels out
         } 
}
void fillUpTheStar(uint32_t c, uint8_t wait) {
  int i,j;
      strip.setPixelColor(80, c);
      delay(wait);
         for (i = 1; i <= 20; i++) {
           strip.setPixelColor(80+i, c);
           strip.setPixelColor(80-i, c);
           strip.show();   // write all the pixels out
           delay(wait);
           }
         for (j=0; j<=29; j++) {
           strip.setPixelColor(j, c);
           strip.setPixelColor(59-j, c);
           strip.show();   // write all the pixels out
           delay(wait);
           } 
}

void fillUpCenterStar(uint32_t c, uint8_t wait) {
  int i,j;
         for (i = 1; i <= 6; i++) {
           strip.setPixelColor(146+i, c);
           strip.setPixelColor(147-i, c);
           strip.show();   // write all the pixels out
           delay(wait);
           }
         for (j=0; j<=18; j++) {
           strip.setPixelColor(103+j, c);
           strip.setPixelColor(140-j, c);
           strip.show();   // write all the pixels out
           delay(wait);
           } 
}

void chaseBetweenLToH(uint32_t c, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i;
         for (i = pointL; i <= pointH; i++) {
           strip.setPixelColor(i, c);
           strip.show();   // write all the pixels out
           delay(wait);
           strip.setPixelColor(i, strip.Color(0,0,0));
           strip.show();   // write all the pixels out
           } 
}

void chaseBetweenHToL(uint32_t c, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i;
         for (i = pointH; i >= pointL; i--) {
           strip.setPixelColor(i, c);
           strip.show();   // write all the pixels out
           delay(wait);
           strip.setPixelColor(i, strip.Color(0,0,0));
           strip.show();   // write all the pixels out
           } 
}

void chaseLineLToH(uint32_t c, uint8_t lineNumber, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i, j;
         for(i = pointL; i < pointH+lineNumber; i++) {
           for(j = 0; j < lineNumber; j++) {
             strip.setPixelColor(i-j, c);
             }
         strip.show();   // write all the pixels out
         delay(wait);
         turnAllOff();
         } 
}

void chaseLineHToL(uint32_t c, uint8_t lineNumber, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i, j;
         for(i = pointH; i > pointL; i--) {
           for(j = 0; j              strip.setPixelColor(i+j, c);
           }
          strip.show();   // write all the pixels out
          delay(wait);
          turnAllOff();
          } 
}

void chaseToCenter(uint32_t c, uint8_t lineNumber, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i, j, k;
  i = pointL;
  k = pointH;
  while(i < k && k > i) {
           for(j = 0; j < lineNumber; j++) {
             strip.setPixelColor(i-j, c);
             strip.setPixelColor(k+j, c);
           }
  strip.show();   // write all the pixels out
  delay(wait);
  i++;
  k--;
  turnAllOff();
  }
}

void chasePastCenter(uint32_t c, uint8_t lineNumber, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i, j, k;
  i = pointL;
  k = pointH;
  while(i < pointH && k > pointL) {
           for(j = 0; j < lineNumber; j++) {
             strip.setPixelColor(i-j, c);
             strip.setPixelColor(k+j, c);
           }
  strip.show();   // write all the pixels out
  delay(wait);
  i++;
  k--;
  turnAllOff();
  }
}

void turnAllOn(uint32_t c, uint32_t wait) {
  int i; 
  for (i=0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, c);  // turn all pixels on
  }
  strip.show();   // write all the pixels out
  delay(wait);
}

void turnSegmentOn(uint32_t c, uint32_t wait, uint8_t startofseg, uint8_t endofseg) {
  int i; 
  for (i=startofseg; i <= endofseg; i++) {
    strip.setPixelColor(i, c);  // turn all pixels on
  }
  strip.show();   // write all the pixels out
  delay(wait);
}


void fadeUpSeg(uint32_t r, uint32_t g, uint32_t b, uint32_t wait, uint8_t startofseg, uint8_t endofseg) {
  int i, j;
  for (j=0; j <= 100; j++) {
    for (i=startofseg; i<=endofseg; i++) {
      strip.setPixelColor(i, strip.Color((r*j)/100,(g*j)/100,(b*j)/100));
    }
  strip.show();
  }
  delay(wait);
}

void fadeDownSeg(uint32_t r, uint32_t g, uint32_t b, uint32_t wait, uint8_t startofseg, uint8_t endofseg) {
  int i, j;
  for (j=100; j >= 0; j--) {
    for (i=startofseg; i<=endofseg; i++) {
      strip.setPixelColor(i, strip.Color((r*j)/100,(g*j)/100,(b*j)/100));  // turn all pixels on
    }
  strip.show();
  }
  delay(wait);
}

void fadeUp(uint32_t r, uint32_t g, uint32_t b, uint32_t wait) {
  int i, j;
  for (j=0; j <= 100; j++) {
    for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, strip.Color((r*j)/100,(g*j)/100,(b*j)/100));
    }
  strip.show();
  }
  delay(wait);
}

void fadeDown(uint32_t r, uint32_t g, uint32_t b, uint32_t wait) {
  int i, j;
  for (j=100; j >= 0; j--) {
    for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, strip.Color((r*j)/100,(g*j)/100,(b*j)/100));  // turn all pixels on
    }
  strip.show();
  }
  delay(wait);
}

void chaseMultipleLinesLToH(uint8_t lineNumber, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i, j;
         for(i = pointL; i <= pointH; i++) {
           for(j = 0; j < lineNumber; j++) {
             strip.setPixelColor(i, strip.Color(0,0,127));
             strip.setPixelColor(i+j+(2*lineNumber), strip.Color(25,0,0));
             strip.setPixelColor(i+j+(3*lineNumber), strip.Color(0,25,0));
             strip.setPixelColor(i+j+(4*lineNumber), strip.Color(25,25,0));
             strip.setPixelColor(i+j+(5*lineNumber), strip.Color(0,25,25));
             strip.setPixelColor(i+j+(6*lineNumber), strip.Color(25,0,25));
             strip.setPixelColor(i+j+(7*lineNumber), strip.Color(0,0,25));
             strip.setPixelColor(i+j+(8*lineNumber), strip.Color(25,0,0));
             strip.setPixelColor(i+j+(9*lineNumber), strip.Color(0,0,0));
            
           }
         strip.show();   // write all the pixels out
         delay(wait);
         } 
}

void turnAllOff() {
  int i; 
  for (i=0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, 0);  // turn all pixels off
  }
  strip.show();   // write all the pixels out
}

void randomSparkleUpSegment(uint32_t c, uint32_t density, uint8_t wait, uint8_t pointL, uint8_t pointH) {
  int i,j,location;
    for (j=pointL; j<=pointH; j++) {
      for (i=0; i <= density; i++) {
      location = random(pointL,j);
      strip.setPixelColor(location, c);
      }
    strip.show();   // write all the pixels out
    delay(wait);
    turnAllOff();
    strip.show();   // write all the pixels out
    } 
}

void randomSparkleUpStrip(uint32_t c, uint32_t density, uint8_t wait) {
  int i,j,location;
    for (j=density; j       for (i=0; i <= density; i++) {
      location = random(0,j);
      strip.setPixelColor(location, c);
      }
    strip.show();   // write all the pixels out
    delay(wait);
    turnAllOff();
    strip.show();   // write all the pixels out
    } 
}

void randomSparkle(uint32_t c, uint32_t density, uint8_t wait) {
  int i,j,location;
  for (j=0; j < 200; j++) {
      for (i=0; i <= density; i++) {
         location = random(0,strip.numPixels()); //random location in first 5th of strip
         strip.setPixelColor(location, c);
      }
    strip.show();   // write all the pixels out
    delay(wait);
    turnAllOff();
    strip.show();   // write all the pixels out
         }
}

void randomColorSparkle(uint8_t wait) {
  int i;
  int location1, location2, location3, location4, location5;
  int color1, color2, color3;
       for (i=0; i < 200; i++) {
         location1 = random(0,32); //random location in first 5th of strip
         location2 = random(33,64); //random location in 2nd 5th of strip
         location3 = random(65,96); //random location in 3rd 5th of strip
         location4 = random(97,128); //random location in 4th 5th of strip
         location5 = random(129,159); //randon location in last 5th of strip
        
         color1 = random(25);
         color2 = random(25);
         color3 = random(25);
        
         strip.setPixelColor(location1, strip.Color(color1,color2,0));
         strip.setPixelColor(location2, strip.Color(color3,0,color1));
         strip.setPixelColor(location3, strip.Color(0,color2,color3));
         strip.setPixelColor(location4, strip.Color(color1,color2,0));
         strip.setPixelColor(location5, strip.Color(color3,0,color1));
         strip.show();   // write all the pixels out
         delay(wait);
         strip.setPixelColor(location1, strip.Color(0,0,0));
         strip.setPixelColor(location2, strip.Color(0,0,0));
         strip.setPixelColor(location3, strip.Color(0,0,0));
         strip.setPixelColor(location4, strip.Color(0,0,0));
         strip.setPixelColor(location5, strip.Color(0,0,0));
         strip.show();   // write all the pixels out
         }
}

void twoColorSparkle(uint32_t c1, uint32_t c2, uint32_t density, uint8_t wait) {
  int i,j,location1,location2;
  for (j=0; j < 200; j++) {
      for (i=0; i <= density; i++) {
         location1 = random(0,strip.numPixels()); //random location number 1
         location2 = random(0,strip.numPixels()); //random location number 2
         strip.setPixelColor(location1, c1);
         strip.setPixelColor(location2, c2);
      }
    strip.show();   // write all the pixels out
    delay(wait);
    turnAllOff();
    strip.show();   // write all the pixels out
         }
}

void rainbow(uint8_t wait) {
  int i, j;
  
  for (j=0; j < 384; j++) {     // 3 cycles of all 384 colors in the wheel
    for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel( (i + j) % 384));
    } 
    strip.show();   // write all the pixels out
    delay(wait);
  }
}

// Slightly different, this one makes the rainbow wheel equally distributed
// along the chain
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;
 
  for (j=0; j < 384 * 5; j++) {     // 5 cycles of all 384 colors in the wheel
    for (i=0; i < strip.numPixels(); i++) {
      // tricky math! we use each pixel as a fraction of the full 384-color wheel
      // (thats the i / strip.numPixels() part)
      // Then add in j which makes the colors go around per pixel
      // the % 384 is to make the wheel cycle around
      strip.setPixelColor(i, Wheel( ((i * 384 / strip.numPixels()) + j) % 384) );
    } 
    strip.show();   // write all the pixels out
    delay(wait);
  }
}

// fill the dots one after the other with said color
// good for testing purposes
void colorWipe(uint32_t c, uint8_t wait) {
  int i;
 
  for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

// Chase a dot down the strip
// good for testing purposes
void colorChase(uint32_t c, uint8_t wait) {
  int i;
 
  for (i=0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, 0);  // turn all pixels off
  }
 
  for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      if (i == 0) {
        strip.setPixelColor(strip.numPixels()-1, 0);
      } else {
        strip.setPixelColor(i-1, 0);
      }
      strip.show();
      delay(wait);
  }
}

/* Helper functions */

//Input a value 0 to 384 to get a color value.
//The colours are a transition r - g -b - back to r

uint32_t Wheel(uint16_t WheelPos)
{
  byte r, g, b;
  switch(WheelPos / 128)
  {
    case 0:
      r = 25 - WheelPos % 128;   //Red down
      g = WheelPos % 128;      // Green up
      b = 0;                  //blue off
      break;
    case 1:
      g = 25 - WheelPos % 128;  //green down
      b = WheelPos % 128;      //blue up
      r = 0;                  //red off
      break;
    case 2:
      b = 25 - WheelPos % 128;  //blue down
      r = WheelPos % 128;      //red up
      g = 0;                  //green off
      break;
  }
  return(strip.Color(r,g,b));
}
 
wirenut1980 (author) 1 year ago
Sorry for the late reply. The only libraries I included was LPD8806.h and
epierce1 year ago
I just recieved my light strip do I have to include LPD8806.h and .cpp?
great work! have you worn this in vegas yet?
wirenut1980 (author)  amandaghassaei1 year ago
Not yet but a great idea! Thank you!
wirenut1980 (author) 1 year ago
Thank you all for the great comments!!!!!
I think Its a very original an funny costume! well done!!!
binoyxj1 year ago
Interesting project. Thanks for sharing.
hitro1 year ago
Bravo!