// Pin for the speaker
const int speakerPin = 3;

// Fibonacci intervals (in milliseconds)
int intervals[] = {1000, 1000, 2000, 3000, 5000};

void setup() {
  // Initialize speaker pin as output
  pinMode(speakerPin, OUTPUT);
}

void loop() {
  // Frequency for the tone (440 Hz is the note A4)
  int frequency = 440;

  // Loop through the Fibonacci intervals and play sound
  for (int i = 0; i < 5; i++) {
    int interval = intervals[i];

    // Play the tone on the speaker for the current interval
    tone(speakerPin, frequency, 500);  // 500ms tone duration

    // Wait for the Fibonacci interval before the next tone
    delay(interval);

    // Stop the tone
    noTone(speakerPin);

    // Delay before next sound
    delay(100); // A small delay between tones
  }

  // Optionally, loop or stop after a single cycle
  while (true);  // Stops the loop, remove this line if you want the loop to repeat
}