User:Inge Hoonte/clapping2 arduino: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 8: Line 8:


(beetje later)
(beetje later)
Tried making two outputs, speakers, but couldn't get it to work.
Tried making two outputs, speakers, but couldn't get it to work (added resistor, didn't work)


  int speakerPin = 13;
  int speakerPin = 13;
  int speakerPin2 = 8;
  int speakerPin2 = 8;
  int thedelay = 10;
  int thedelay = 10;
 
   
   
  char pat[] = "xxx xx x xx ";
  char pat[] = "xxx xx x xx ";

Revision as of 20:42, 1 November 2010

Experimented with the pause between two tones first, but maybe not the right route to go

for (i=0; i<12; i+=1) {
       if (pat[i] == 'x') tone(speakerPin, 440, 40);
       if (pat[i] == ' ') delay(20);
       delay(thedelay);


(beetje later) Tried making two outputs, speakers, but couldn't get it to work (added resistor, didn't work)

int speakerPin = 13;
int speakerPin2 = 8;
int thedelay = 10;


char pat[] = "xxx xx x xx ";
int patlen = strlen(pat);

void setup()
{ //imaginary content
}
void loop ()
{
   int i;
   int i2;
   int j;
   
   for (j=0; j<patlen+1; j++) {
   
     for (i=0; i<patlen; i++) {
       if (pat[i] == 'x') tone(speakerPin, 440, 50);
       delay(40);
       if (pat[i2] == 'x') tone(speakerPin2, 800, 50);
       
     }
       {
        // for (i2=patlen-1; i2<patlen; i
          // if (pat[i2] == 'x') tone(speakerPin, 500, 10);
       }
   }
   
   delay(thedelay*10);
}