Workshops/SoundBubble

From DigitalCraft_Wiki
Revision as of 21:06, 2 October 2014 by Jmjdetroije (talk | contribs) (Created page with "With this workshop we silkscreen printed a piece of fabric with conductive ink. <br> Then we connected the printed fabric with an Arduino and speaker and created a Sound Bubbl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

With this workshop we silkscreen printed a piece of fabric with conductive ink.
Then we connected the printed fabric with an Arduino and speaker and created a Sound Bubble.




You can find more about the silkscreen process [1].

The Code that we used:

#include "pitches.h"

// notes in the melody: int melody[] = {

 NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};

// note durations: 4 = quarter note, 8 = eighth note, etc.: int noteDurations[] = {

 4, 8, 8, 4,4,4,4,4 };

void setup () {

 pinMode(8, OUTPUT);

pinMode(9, OUTPUT); digitalWrite(9, LOW);

pinMode(13, OUTPUT);

}


void loop() {

 // iterate over the notes of the melody:
 
 //melody
 for (int thisNote = 0; thisNote < 8; thisNote++) {
   // to calculate the note duration, take one second 
   // divided by the note type.
   //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
   int noteDuration = 1000/noteDurations[thisNote];
   tone(8, melody[thisNote],noteDuration);
   // to distinguish the notes, set a minimum time between them.
   // the note's duration + 30% seems to work well:
   int pauseBetweenNotes = noteDuration * 1.30;
   delay(pauseBetweenNotes);
   // stop the tone playing:
   noTone(8);
 }

//sirene for(int i = 10000; i > 500; i = i - 50) {

 beatFunction(i);

} }

void melodyBox ()}


{

void beatFunction(int beatNum)

{ digitalWrite(8, HIGH); digitalWrite(13, HIGH);

for(int i = 0; i<beatNum; i = i + 1 ) __asm__("nop\n\t");

//delay(2);

digitalWrite(8, LOW); digitalWrite(13, LOW);

for(int i = 0; i<beatNum; i = i + 1 ) __asm__("nop\n\t"); }