User:Laura Macchini/prototyping/ArduinoClappingMusic
< User:Laura Macchini
Revision as of 14:26, 26 October 2010 by Laura Macchini (talk | contribs) (Created page with "<source lang="c"> char pat[] = "xxx xx x xx "; char doubled[24]; void setup() { doubled[0] = 0; strcat (doubled, pat); strcat (doubled, pat); int doublen = strlen(doubl...")
char pat[] = "xxx xx x xx ";
char doubled[24];
void setup() {
doubled[0] = 0;
strcat (doubled, pat);
strcat (doubled, pat);
int doublen = strlen(doubled);
int patlen = strlen(pat);
int q = 0;
while (q<100) {
for (int k=0; k<patlen; k++) {
int toner = 200;
if (k%2 == 0) toner = 200;
else toner = 150;
for (int p=0; p<patlen; p++) {
if (pat[p] == 'x') {
tone(13, 100, 25);
}
delay(150);
}
for (int p=0; p<patlen; p++) {
if (pat[p+k] == 'x') {
tone(13, toner, 25);
}
delay(150);
}
}
}
}
void loop () {}