Arduino Thookki Song

 













Program

// Generated Code for Arduino
const int BUZZER_PIN = 8; // Change to your buzzer pin

int melody[] = { 0, 392, 0, 349, 0, 330, 0, 330, 0, 330, 0, 330, 0, 330, 0, 349, 0, 294, 0, 330, 0, 392, 0, 349, 0, 330, 0, 330, 0, 330, 0, 330, 0, 330, 0, 349, 0, 294, 0, 330, 0, 392, 0, 349, 0, 330, 0, 330, 0, 330, 0, 330, 0, 330, 0, 349, 0, 294, 0, 330, 0, 330, 0, 494, 0, 494, 0, 440, 0, 440, 0, 523, 0, 494, 0, 440, 0, 392, 0, 392, 0, 349, 0, 330, 0, 330, 0, 330, 0, 330, 0, 330, 0, 349, 0, 294, 0, 330, 0, 392, 0, 349, 0, 330, 0, 330, 0, 330, 0, 330, 0, 330, 0, 349, 0, 294, 0, 330, 0, 392, 0, 349, 0, 330, 0, 330, 0, 330, 0, 330, 0, 330, 0, 349, 0, 294, 0, 330, 0, 330, 0, 330, 0, 440, 0, 494, 0, 523, 0, 494, 0, 494, 0, 392, 0, 247, 0, 392, 0, 392, 0, 247, 0, 392, 0, 392, 0, 247, 0, 349, 0, 392, 0, 494, 0, 392, 0, 349, 0, 349, 0, 262, 0, 392, 0, 392, 0, 262, 0, 392, 0, 392, 0, 247, 0, 392, 0, 440, 0, 523, 0, 392, 0, 349, 0, 330, 0, 247, 0, 392, 0, 392, 0, 247, 0, 392, 0, 392, 0, 262, 0, 392, 0, 440, 0, 494, 0, 392, 0, 392, 0, 349, 0, 349, 0, 494, 0, 494, 0, 440, 0, 440, 0, 523, 0, 494, 0, 440, 0, 392, 0, 349 };
int durations[] = { 2402, 182, 186, 150, 168, 99, 100, 98, 219, 64, 119, 67, 102, 81, 234, 136, 66, 167, 150, 115, 219, 164, 186, 135, 182, 84, 83, 80, 252, 68, 116, 66, 101, 118, 216, 98, 68, 150, 186, 131, 204, 149, 151, 133, 198, 83, 102, 80, 220, 83, 103, 61, 119, 82, 202, 116, 51, 115, 219, 115, 202, 80, 152, 100, 85, 97, 536, 65, 102, 65, 118, 350, 118, 81, 104, 79, 253, 98, 269, 81, 287, 165, 134, 98, 103, 81, 220, 64, 121, 81, 67, 101, 217, 99, 50, 98, 235, 98, 204, 164, 185, 131, 187, 62, 102, 81, 254, 48, 136, 46, 54, 100, 249, 136, 33, 97, 218, 116, 202, 184, 132, 153, 165, 97, 71, 81, 234, 65, 102, 65, 103, 97, 202, 100, 52, 103, 216, 95, 219, 66, 85, 80, 119, 133, 468, 98, 285, 467, 68, 81, 70, 81, 237, 181, 986, 98, 69, 97, 72, 79, 252, 98, 53, 81, 87, 132, 203, 116, 49, 98, 86, 80, 102, 65, 86, 66, 102, 64, 86, 81, 269, 98, 70, 64, 102, 98, 219, 81, 85, 66, 86, 114, 219, 116, 34, 99, 101, 82, 85, 64, 112, 71, 104, 96, 86, 99, 250, 100, 68, 82, 102, 115, 201, 149, 37, 63, 102, 81, 235, 134, 37, 79, 69, 99, 69, 97, 106, 94, 102, 82, 101, 82, 285, 82, 119, 48, 104, 63, 602, 65, 103, 81, 102, 384, 117, 82, 85, 81, 102, 82, 106, 64 };
int totalNotes = 252;

void setup() {
  pinMode(BUZZER_PIN, OUTPUT);
  playMelody();
}

void loop() {
  // Keeps melody from repeating. Move playMelody() here if you want it to loop.
}

void playMelody() {
  for (int i = 0; i < totalNotes; i++) {
    if (melody[i] == 0) {
      delay(durations[i]); // Rest
    } else {
      tone(BUZZER_PIN, melody[i]); // Play Note
      delay(durations[i]);
      noTone(BUZZER_PIN);
    }
  }
}



Circuit Diagram 









Previous Post Next Post