// Define the buzzer pin
const int buzzerPin = 8;
const int myDelay = 150;
//const duration = 100;
void setup() {
// Set the buzzer pin as an OUTPUT
pinMode(buzzerPin, OUTPUT);
}
void loop() {
// Make the buzzer beep
beep();
// Wait for 5 seconds
delay(1000);
}
void beep() {
int melody[] = {400,400,800,1000,1500,2500,3000,3500,4000,4500,4750};// 11 elements
for(int i = 0; i<=11; ++i){
tone(buzzerPin, melody[i], 100);//min 100
delay(myDelay);
}
noTone(buzzerPin);
}