int Do = 262; // do
int Re = 294; // re
int Mi = 330; // mi
int Fa = 349; // fa
int Sol = 392; // sol
int Lya = 440; // la
int Si = 494; // si
int donce = 523; // do (thin)
#define buz 3 //buzzer name and pin
#define button 2
int but = 0; // For read situation by buton
void setup() {
pinMode(buz, OUTPUT); //We set INPUT or OUTPUT
pinMode(button, INPUT);
}
void loop() {
but = digitalRead(button); // Reading the button situation
if (but == HIGH)
{
tone(buz,donce); //The alarm starting
delay(500);
noTone(buz);
delay(10);
tone(buz,Re);
delay(300);
}
else //When button doesn't HIGH
noTone(buz);
}