Maddy
Published © GPL3+

Fiber Optic Homecoming

Turn any outfit into a light up outfit, for prom, homecoming, weddings, or any other occasion!

IntermediateFull instructions providedOver 1 day6,007
Fiber Optic Homecoming

Things used in this project

Hardware components

RGB Diffused Common Cathode
RGB Diffused Common Cathode
×28
Arduino LilyPad Main Board
Arduino LilyPad Main Board
×2
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Schematic

Code

RGB Code

Arduino
Uses different methods to change the color of the LEDs.
int red = 11;
int green = 9;
int blue = 5;
void setup() {
  pinMode(red,OUTPUT);
  pinMode(green,OUTPUT);
  pinMode(blue,OUTPUT);
}

void loop() {
/*the different delays in fade and strobe allows for fast and slow iterations*/
  fade(2);
  fade(2);
  fade(2);
  strobe(300);
  strobe(300);
  strobe(300);
  fade(10);
  strobe(100);
  strobe(100);
  strobe(100);
  strobe(100);
  strobe(100);
}

void off()
{
  rLight(0);
  gLight(0);
  bLight(0);
}

void strobe(int strobeDelay)
{
  showRGB(255,255,255);//white
  delay(strobeDelay);
  showRGB(0,255,255);//cyan
  delay(strobeDelay);
  showRGB(255,0,255);//purple
  delay(strobeDelay);
  showRGB(255,255,0);//yellow
  delay(strobeDelay);
  showRGB(0,0,255);//blue
  delay(strobeDelay);
  showRGB(0,255,0);//green
  delay(strobeDelay);
  showRGB(255,0,0);//red
  delay(strobeDelay);
}

void fade(int fadeDelay)
{
  int r = 255;
  int g = 0;
  int b = 0;
  for(; b<=255;b++){
    showRGB(r,g,b);
    delay(fadeDelay * 3);
/*the delay is multiplied by different factors because the red portions appear quicker than just blue and green because red appears so much dimmer*/
  }
  for(; r>=0; r--){
    showRGB(r,g,b);
    delay(fadeDelay * 2);
  }
  for(; g<=255; g++){
    showRGB(r,g,b);
    delay(fadeDelay);
  }
  for(; b>=0; b--){
    showRGB(r,g,b);
    delay(fadeDelay);
  }
  for(;r<=255;r++){
    showRGB(r,g,b);
    delay(fadeDelay * 2);
  }
  for(;g>=0;g--){
    showRGB(r,g,b);
    delay(fadeDelay * 3);
  }
}

void showRGB(int r, int g, int b){
  rLight(r);
  gLight(g);
  bLight(b);
}

void rLight(int r){
  if(r>=0 && r<=255)
    analogWrite(red, r);
}

void gLight(int g){
  if(g>=0 && g<=255)
    analogWrite(green, g);
}

void bLight(int b){
  if(b>=0 && b<=255)
  analogWrite(blue, b);
}

Credits

Maddy

Maddy

3 projects • 57 followers
Computer Science Engineering second year at The Ohio State University, in love with code and electronics.

Comments