User:Inge Hoonte/arduino notes oct 26
< User:Inge Hoonte
Revision as of 16:41, 26 October 2010 by Inge Hoonte (talk | contribs) (Created page with "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<s...")
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); }