const int buzzer = 9; //buzzer to arduino pin 9
void setup()
{
Serial.begin(9600);
pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
Serial.println("Setup Ready");
}
void loop()
{
Serial.println("loop start");
tone(buzzer, 440,2000); // Send 440Hz sound signal for 2000mSec
Serial.println("First ton to hear ?");
delay(500); // ...for 1 sec
//noTone(buzzer); // Stop sound...
tone(buzzer, 880,1500); // Send 880Hz sound signal...
Serial.println("anything to hear ?");
delay(500); // ...for 1sec
}