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 7Source Code Part 2

The Entire Code


#define NUM_ELEM(x) (sizeof (x) / sizeof (*(x)))

int lilypad[] = {
1,1,1,1,1,1,1,1, //L
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,

1,1,1,1,0,1,0,0, //i
0,0,0,0,0,0,0,0,

1,1,1,1,1,1,1,1, //l
0,0,0,0,0,0,0,0,

1,0,0,0,0,1,1,0, //y
0,1,0,0,1,0,0,0,
0,0,1,1,0,0,0,0,
0,0,0,1,1,1,1,0,
0,0,0,0,0,0,0,0,

1,1,1,1,1,1,1,1, //p
0,0,0,0,1,0,0,1,
0,0,0,0,1,0,0,1,
0,0,0,0,0,1,1,1,
0,0,0,0,0,0,0,0,

1,1,1,1,0,0,0,0, //a
1,0,0,1,0,0,0,0,
1,0,0,1,1,0,0,0,
1,1,1,1,1,0,0,0,
0,0,0,0,0,0,0,0,

1,1,1,1,0,0,0,0, //d
1,0,0,1,0,0,0,0,
0,0,0,1,0,0,0,0,
1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0};


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

int ledPinArray[8] = {6,7,8,9,10,11,12,13};
// The setup() method runs once, when the sketch starts

int columnDelay;
int sizeWord = 0;
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);

columnDelay = 2.5; //wait 2.5ms between each column flash
Serial.begin(9600);
Serial.print("Number of lilypad: ");
Serial.println(NUM_ELEM(lilypad));
delay(2000);
sizeWord = NUM_ELEM(lilypad);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

/*void loop()
{
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
}*/

void loop()
{
//Serial.print("Number of lilypad: ");
//Serial.println(NUM_ELEM(lilypad));
//delay(1000);
printWord(lilypad);
delay(8); //wait a little bit between each display of the word LilyPad
}

void printWord(int wordVar[]) {

int numRows = sizeWord/8;
for(int j = 0; j < numRows; j++) {
for(int i = 0; i<8; i++) {
digitalWrite(i+6, wordVar[i+j*8]);
}
delay(columnDelay);
}
« Previous StepDownload PDFView All StepsNext Step »
2 comments
Mar 18, 2010. 6:20 PMZovits says:
Why did you create the ledPin6-ledPin13 variables?
They don't seem to be used anywhere.
Or is it a way to tell the Lilypad that those outputs are used to power LEDs?

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)