User:Inge Hoonte/clapping2 arduino: Difference between revisions
Inge Hoonte (talk | contribs) (Created page with "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); ...") |
Inge Hoonte (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
if (pat[i] == ' ') delay(20); | if (pat[i] == ' ') delay(20); | ||
delay(thedelay); | delay(thedelay); | ||
(beetje later) | |||
Tried making two outputs, speakers, but couldn't get it to 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); | |||
} |
Revision as of 18:19, 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.
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); }