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



#define BUZZER 3

const int notes[] = {
  294,294,587,440,466,0,440,392,349,294,349,392,
  262,262,587,440,466,0,440,392,349,294,349,392,
  247,247,587,440,466,0,440,392,349,294,349,392,
  233,233,587,440,466,0,440,392,349,294,349,392,
  294,294,587,440,466,0,440,392,349,294,349,392,
  262,262,587,440,466,0,440,392,349,294,349,392,
  247,247,587,440,466,0,440,392,349,294,349,392,
  233,233,587,440,466,0,440,392,349,294,349,392
};

const byte count = sizeof(notes) / sizeof(notes[0]);
const int beat = 115;

void setup() {
  pinMode(BUZZER, OUTPUT);
}

void loop() {
  for (byte i = 0; i < count; i++) {
    int duration = (notes[i] == 0) ? beat : beat * 2;

    if (notes[i] == 0) {
      noTone(BUZZER);
    } else {
      tone(BUZZER, notes[i]);
    }

    delay(duration);
    noTone(BUZZER);
    delay(beat / 5);
  }

  delay(800);
}