User:Birgit bachler/clappingarduino
< User:Birgit bachler
Revision as of 16:22, 1 November 2010 by Birgit bachler (talk | contribs)
int speakerPin = 13;
int thedelay = 10;
char pat[] = "xxx xx x xx ";
int patlen = strlen(pat);
void setup(){
}
void loop (){
for(int up=0; up<patlen; up++){
for(int i=0; i<patlen; i++){
int i2=i+up;
if (i2>(patlen-1)){
i2=i-patlen+up;
}
if (pat[i] == 'x') tone(speakerPin, 400, thedelay);
delay(10);
if (pat[i2] == 'x') tone(speakerPin, 800, thedelay);
delay(thedelay*thedelay);
}
delay(thedelay*thedelay);
}
}