3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

LilyPad Wrist Band POV

Step 3Sewing LEDs

Sewing LEDs
Before sewing make sure the plus side (+) of the LEDs is facing the Lilypad.   Make sure that each LED plus side is not connected or touching anything other than the corresponding pin of the LilyPad. 

We are going to use a fairly common trick.  We know that later we will have to attach a power supply to the LilyPad and it can be difficult to combine thread lines.  Therefore, we can use a little trick by declaring pin 5 as output and setting the pin to low (a fake ground).  In your code, you will write this:

int ground = 5;

void setup() {
   pinMode(ground,OUTPUT);
   digitalWrite(ground,LOW);



Note: while we can set any pin to ground, usually, it is not recommend to set a pin HIGH as another PLUS pin.  LilyPads can only output 40mA from each digital I/O pin.

We can stitch all of the minus sides of the LEDs together and then to pin 5.

After you complete your sewing, plug-in your LilyPad to your computer and use the following code to flash all the lights. 

int ledPin13 = 13; // LED connected to digital pin 13
int ledPin12 = 12; // LED connected to digital pin 12
int ledPin11 = 11; // LED connected to digital pin 11
int ledPin10 = 10; // LED connected to digital pin 10
int ledPin9 = 9; // LED connected to digital pin 9
int ledPin8 = 8; // LED connected to digital pin 8
int ledPin7 = 7; // LED connected to digital pin 7
int ledPin6 = 6; // LED connected to digital pin 6
int ground = 5; // LED connected to digital 5 "ground"

int ledPinArray[8] = {6,7,8,9,10,11,12,13};

void setup() {
// initialize the digital pin as an output:
for(int i = 0; i < 8; i++){
pinMode(ledPinArray[i],OUTPUT);
}
pinMode(ground, OUTPUT);
digitalWrite(ground, LOW);
}

{
for(int i = 0; i < 8; i++){
digitalWrite(ledPinArray[i],HIGH);
}

delay(1000); // wait for a second
for(int i = 0; i < 8; i++){
digitalWrite(ledPinArray[i],LOW);
}
delay(1000); // wait for a second
}

« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
38
Followers
11
Author:quasiben(Electric Stitches)