thanks for the reply man.. i'm sorry i did failed to write what I really meant.. sorry for my grammar because english is my 2nd language.. what i'm trying to do is that I want the servo to run only once every time that my alarm code is activated. because my concern is that my alarm code runs for example for 10minutes and if i only use the sweep function for the servo it could run multiple times if the button is pressed.. what i'm trying to do is to limit each functionality of the servo to only one every time the alarm is triggered and automatically turns off the alarm if the button is pressed. I hope you can help me with that here is my code and i'm really having a hard time please help me ![]()
// Set alarm to activate two times a day
byte HOUR1 = 19, MINUTE1 = 54;
byte HOUR2 = 19, MINUTE2 = 55;
byte HOUR3 = 19, MINUTE3 = 56;
byte HOUR4 = 19, MINUTE4 = 57;
if(((now.hour()==HOUR1)&&(now.minute()==MINUTE1))) // compares the time in the RTC circuit to the input time //
{
if(flag == 1)
{
lcd.setCursor(9,1);
lcd.print(" Med 1 ");
lcd.println();
digitalWrite(LED,HIGH);
delay(10000); //delay for 25sec
lcd.clear(); //Delete the Display of Medicine after the buzzer
delay(1000); //Delay time for the lcd.clear function
flag = 0; // clear flag
delay(1000);
}
else {
digitalWrite(LED,LOW);
}
}
i really dont know actually how to integrate the servo code to my alarm code. thanks again ![]()