Blinky Ugly Sweater

by logansam in Circuits > Wearables

827 Views, 9 Favorites, 0 Comments

Blinky Ugly Sweater

Blinky Sweater

I'm a little late to the ugly sweater game, but I actually made this in December. It's very simple, just some LEDs connected to a chipKIT microcontroller.

Planning

_SHL2747.jpg

My sweater was pretty much just LED's connected directly to the output pins of a Fubarino Mini. I chose the board because we had a few that were unused and I like the size of the board.

Wiring

DSC_0016-2.jpg
DSC_0017-2.jpg

Each LED needs a wire to the anode (+) and a single ground wire that connects to all the cathodes (-). I pushed the LEDs through the swearer where I wanted them and cut pieces of perf board to solder the wires to the LEDs. If I was thinking ahead I would have cut 2x6 pieces because there is 2 leads from the LED, the positive and 2 ground, one from the last LED and one to the next LED. You can see that there are a few extra pins set up if I wanted to add more LEDs.

Code

That's it! Here's the code I used, it just picks a random pin, a random delay and flashes the LED for 50 milliseconds. For more projects and news about Digilent, check out or blog at blog.digilentinc.com.

int ranNum;
int ranDel;

void setup() {
  randomSeed (analogRead (0));    // randomize
  pinMode(31, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(29, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(27, OUTPUT);
  pinMode(26, OUTPUT);
  pinMode(25, OUTPUT);
}

void loop() { 
  //Generate random number for pins
  ranNum=random(24,32);
  //Generate random delay
  ranDel=random(25, 75);
  delay(ranDel);
  digitalWrite(ranNum, HIGH);
  delay(50);
  digitalWrite(ranNum, LOW);   
}