Arduino tutorial #06 - Membuat Nada/Tone Dengan Arduino
int i;
int speaker=8;
int buzz=1;
void setup() {
pinMode(speaker, OUTPUT);
}
// the loop function runs over and over again forever
void loop()
{
tone(speaker, 262); delay(500); //do
tone(speaker, 294); delay(500); //re
tone(speaker, 330); delay(500); //mi
tone(speaker, 349); delay(500); //fa
tone(speaker, 395); delay(500); //sol
tone(speaker, 440); delay(500); //la
tone(speaker, 494); delay(500); //si
tone(speaker, 523); delay(500); //do
tone(speaker, 100);
noTone(speaker);delay(1000);
tone(speaker, 523); delay(500);
tone(speaker, 494); delay(500);
tone(speaker, 440); delay(500);
tone(speaker, 395); delay(500);
tone(speaker, 349); delay(500);
tone(speaker, 330); delay(500);
tone(speaker, 294); delay(500);
tone(speaker, 262); delay(500);
tone(speaker, 100);
noTone(speaker);delay(1000);
}
No comments:
Post a Comment