Hey :D.
I am trying to make an alert which ends with the pressing of a button.
This is the code:
if (myRTC.hours >= alarmhour && myRTC.minutes >= alarmminute && used == 0)
{
lcd.setCursor( 0, 0);
lcd.print(" ");
lcd.print("Zeit");
lcd.print(" ");
lcd.print("zum");
lcd.print(" ");
lcd.setCursor( 0, 1);
lcd.print(" ");
lcd.print("Aufstehen!");
lcd.print(" ");
tone(alarm, 466, 1200);//Takt 1
delay(1600);
**tone(alarm, 466, 200); **
delay(210);
**tone(alarm, 466, 200); **
delay(210);
tone(alarm, 466, 200);
**delay(210); **
tone(alarm, 466, 200);
**delay(210); **
button5 = digitalRead(input5);
Serial.println(button5, DEC);
if (button5 == 1)
{
used = 1;
}
tone(alarm, 466, 400);//Takt 2
delay(410);
tone(alarm, 415, 200);
**delay(210); **
tone(alarm, 466, 1000);
delay(1050);
tone(alarm, 466, 200);
delay(210);
tone(alarm, 466, 200);
delay(210);
tone(alarm, 466, 200);
delay(210);
tone(alarm, 466, 200);
delay(210);
button5 = digitalRead(input5);
Serial.println(button5, DEC);
if (button5 == 1)
{
used = 1;
}
tone(alarm, 466, 400);//Takt 3
delay(410);
tone(alarm, 415, 200);
delay(210);
tone(alarm, 466, 1000);
delay(1050);
tone(alarm, 466, 200);
delay(210);
tone(alarm, 466, 200);
delay(210);
tone(alarm, 466, 200);
delay(210);
tone(alarm, 466, 200);
delay(210);
}
The important things are written in italic
but the problem is when i press the button ant it is running it will run till the end and stop then. I didn`t put the full code in herebecause of its length. I think there are 600 lines xD. So now i am triyng to find a way to jump to the very last line of this code so the alarm stops.
Please can anyone help me?