Tuesday, November 10, 2020

Arduino tutorial #06 - Membuat Nada/Tone Dengan Arduino

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

Membuat Counter mundur menuju Azan dengan Arduino Wemos

Membuat Counter Mundur Menuju Azan dengan Arduino Wemos  #include <Wire.h> #include "RTClib.h" #include "SPI.h" #i...