The Buzzer SOS


Here is the Buzzer's code to do a SOS

  const int pinBuzzer = 5; //Identificate the Buzzer in the analog position  5
void setup() {
pinMode(pinBuzzer,OUTPUT); 
}

void SOS(int n) { //Create a function called SOS with a parameter that you need to put after
tone(pinBuzzer, 440); 
   delay(n); 
  noTone(pinBuzzer); 
   delay(500); 
tone(pinBuzzer, 440); //The tone will sound in 440Hz 
   delay(n); 
  noTone(pinBuzzer); 
   delay(500);  
tone(pinBuzzer, 440); 
   delay(n); 
  noTone(pinBuzzer); 
   delay(500);  
}
void silence (){
  noTone(pinBuzzer); 
   delay(3500); 
}
void loop() {//Made a loop calling the function three time with a different number of parameter
  SOS(500); 
  SOS(1500); 
  SOS(500); 
silence(); 
}