Monday 14 December 2015

Wearable Tech - Daughter's Christmas Jumper






Daughter #1 needed to jazz up her Christmas jumper for school. We had a cheap set of 50 blue LED lights with 3xAA battery pack attached, and she was going to use them as they were.

Itching to use my Arduino Nano I'd acquired a couple of months previously, I suggested an upgrade!

Fastening the lights to the jumper was the hardest bit.






I used this code to program the lights:


// Dim an LED using a PWM pin
int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10

void setup()
{
  // no setup needed
}

void loop()
{
   for (int i=0; i <= 255; i++){
      analogWrite(PWMpin, i);
      delay(15);
   }

   for (int i=0; i <= 3; i++){
     analogWrite(PWMpin, 255);
     delay(500);
     analogWrite(PWMpin, 0);
     delay(500);
   }
   for (int i=0; i <= 10; i++){
     analogWrite(PWMpin, 255);
     delay(100);
     analogWrite(PWMpin, 0);
     delay(100);
   }
   
   
   
   for (int i=0; i <= 255; i++){
      analogWrite(PWMpin, 0-i);
      delay(15);
   } 
}




No comments:

Post a Comment