User:Inge Hoonte/arduino notes oct 26
< User:Inge Hoonte
Revision as of 16:42, 26 October 2010 by Inge Hoonte (talk | contribs)
int speakerPin = 13; int thedelay = 100; //char keycode = 'x' char pat[] = "xxx xx x xx "; int patlen = strlen(pat); void setup() {} void loop () { int i = 0; while (i<strlen(pat)) { if (pat[i] == 'x') tone(speakerPin, 400, 10); delay(thedelay); i = i+1; } //can be written in shorthand: /* for (i=0; i<12; i+=1) if (pat[i] == 'x') tone(speakerPin, 400, 10); delay(thedelay); } */ delay (thedelay*10); }