User:Birgit bachler/clappingarduino
< User:Birgit bachler
Revision as of 16:16, 1 November 2010 by Birgit bachler (talk | contribs) (Created page with "<source lang=c> int speakerPin = 13; int thedelay = 100; char pat[] = "xxx xx x xx "; int patlen = strlen(pat); void setup(){ } void loop (){ for(int up=0; up<patlen; ...")
int speakerPin = 13;
int thedelay = 100;
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(thedelay);
if (pat[i2] == 'x') tone(speakerPin, 800, thedelay);
delay(thedelay);
}
delay(thedelay);
}
}