User:Inge Hoonte/clapping2 arduino

From XPUB & Lens-Based wiki

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);
}