//Quelle zu den Noten:
// https://www.youtube.com/watch?v=aiuyL6170L0

// Frequenzen der Noten
unsigned int C6 = 1047;
unsigned int Ab5 = 831;
unsigned int Bb5 = 932;
unsigned int G5 = 784;
unsigned int F5 = 698;
unsigned int E5 = 659;
unsigned int Eb5 = 622;
unsigned int D5 = 587;
unsigned int Db5 = 554;
unsigned int C5 = 523;
unsigned int B4 = 494;
unsigned int Bb4 = 466;
unsigned int nA4 = 440;
unsigned int Ab4 = 415;
unsigned int G4 = 392;
unsigned int Gb4 = 370;
unsigned int F4 = 349;
unsigned int E4 = 330;
unsigned int Eb4 = 311;
unsigned int D4 = 294;
unsigned int Db4 = 277;
unsigned int C4 = 262;
unsigned int B3 = 247;
unsigned int Bb3 = 233;
unsigned int nA3 = 220;
unsigned int G3 = 196;
unsigned int Gb3 = 185;
unsigned int F3 = 175;
unsigned int E3 = 165;

// Pin für den Summer
const int buzzerPin = 12;

// Funktion, die die Melodie abspielt
void LevelClear() {
  tone(buzzerPin, G3);
  delay(166);
  tone(buzzerPin, C4);
  delay(166);
  tone(buzzerPin, E4);
  delay(166);
  tone(buzzerPin, G4);
  delay(166);
  tone(buzzerPin, C5);
  delay(166);
  tone(buzzerPin, E5);
  delay(166);
  tone(buzzerPin, G5);
  delay(500);
  tone(buzzerPin, E5);
  delay(500);
 
  tone(buzzerPin, E3);
  delay(166);
  tone(buzzerPin, C4);
  delay(166);
  tone(buzzerPin, Eb4);
  delay(166);
  tone(buzzerPin, Ab4);
  delay(166);
  tone(buzzerPin, C5);
  delay(166);
  tone(buzzerPin, Eb5);
  delay(166);
  tone(buzzerPin, Ab5);
  delay(500);
  tone(buzzerPin, Eb5);
  delay(500);
 
  tone(buzzerPin, Bb3);
  delay(166);
  tone(buzzerPin, D4);
  delay(166);
  tone(buzzerPin, F4);
  delay(166);
  tone(buzzerPin, Bb4);
  delay(166);
  tone(buzzerPin, D5);
  delay(166);
  tone(buzzerPin, F5);
  delay(166);
  tone(buzzerPin, Bb5);
  delay(500);
  noTone(buzzerPin);
  delay(50);
  tone(buzzerPin, Bb5);
  delay(166);
  noTone(buzzerPin);
  delay(50);
  tone(buzzerPin, Bb5);
  delay(166);
  noTone(buzzerPin);
  delay(50);
  tone(buzzerPin, Bb5);
  delay(166);
  tone(buzzerPin, C6);
  delay(1100);
  
  // Ton abschalten
  noTone(buzzerPin);
}

void setup() {
  pinMode(buzzerPin, OUTPUT);
  LevelClear(); // Die Melodie wird beim Start abgespielt
}

void loop() {
  // Nichts weiter, da die Melodie nur einmal abgespielt wird
}
