Загрузка данных


```cpp
const int LED_PIN = 9;
const int BUZZER_PIN = 8;
const int POT_PIN = A0;

int melody[] = {
  660, 660, 660,
  510, 660, 770,
  380, 510, 380, 320,
  440, 480, 450, 430,
  380, 660, 760, 860,
  700, 760, 660,
  520, 580, 480
};

int noteDuration[] = {
  100, 100, 100,
  100, 100, 100,
  100, 100, 100, 100,
  100, 100, 100, 100,
  100, 100, 100, 100,
  100, 100, 100,
  100, 100, 100
};

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

void loop() {
  int potValue = analogRead(POT_PIN);
  int blinkDelay = map(potValue, 0, 1023, 50, 1000);
  int frequency = map(potValue, 0, 1023, 200, 2000);

  digitalWrite(LED_PIN, HIGH);
  tone(BUZZER_PIN, frequency);
  delay(blinkDelay);

  digitalWrite(LED_PIN, LOW);
  noTone(BUZZER_PIN);
  delay(blinkDelay);

  if (potValue > 700) {
    playMelody();
  }
}

void playMelody() {
  for (int i = 0; i < 23; i++) {
    digitalWrite(LED_PIN, HIGH);
    tone(BUZZER_PIN, melody[i]);
    delay(noteDuration[i]);
    digitalWrite(LED_PIN, LOW);
    noTone(BUZZER_PIN);
    delay(50);
  }
}
```