soundie: a musical touch-sensitive light-up hoodie

Step 8Sew on your speaker

sew on your speaker

Sew on the speaker.
Using the same techniques as with the LEDs and other components, sew your speaker onto the garment. With the speaker I used, the + and - petals don't matter, but if you're using a different speaker, be sure to pay attention to which is which. The + petal should be connected to one of the numerical petals of the LilyPad main board (I used petal 9), and the - petal should be connected to the - petal of the LilyPad main board.

Test the speaker.
Here's the code I used to test the speaker. If it works, the speaker should hum a fairly constant C note.

int speakerPin = 9; // speaker connected to digital pin 9

void setup() // run once, when the sketch starts
{
pinMode(speakerPin, OUTPUT); // sets the speakerPin to be an output
}

void loop()
{
beep(speakerPin,2093,1000); //C: play the note C 500ms
}

void beep (unsigned char speakerPin, int frequencyInHertz, long timeInMilliseconds) // the sound producing function
{
int x;
long delayAmount = (long)(1000000/frequencyInHertz);
long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2));
for (x=0;x<loopTime;x++)
{
digitalWrite(speakerPin,HIGH);
delayMicroseconds(delayAmount);
digitalWrite(speakerPin,LOW);
delayMicroseconds(delayAmount);
}
}

If the speaker does not work, use the multimeter to test for shorts with the instructions from the previous step.
« 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!
14
Followers
1
Author:kanjun