// Definisikan Pin Buzzer
const int buzzerPin = 8;
// Frekuensi nada standar (dalam Hertz)
const int c = 261; // Do
const int d = 294; // Re
const int e = 329; // Mi
const int f = 349; // Fa
const int g = 392; // Sol
const int a = 440; // La
const int b = 494; // Si
const int C = 523; // Do Tinggi
void setup() {
// put your setup code here, to run once:
pinMode(buzzerPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// Bunyikan tangga nada naik
tone(buzzerPin, c); delay(500); noTone(buzzerPin); delay(100);
tone(buzzerPin, d); delay(500); noTone(buzzerPin); delay(100);
tone(buzzerPin, e); delay(500); noTone(buzzerPin); delay(100);
tone(buzzerPin, f); delay(500); noTone(buzzerPin); delay(100);
tone(buzzerPin, g); delay(500); noTone(buzzerPin); delay(100);
tone(buzzerPin, a); delay(500); noTone(buzzerPin); delay(100);
tone(buzzerPin, b); delay(500); noTone(buzzerPin); delay(100);
tone(buzzerPin, C); delay(500); noTone(buzzerPin); delay(500);
// Jeda sebelum mengulang
delay(1000);
}