Loop inside time alarms

i am working on a multiple switching, using rtc and time alarms library. but i stumbled on a problem of putting a loop function inside the time alarm function. my code is as follows. and is basically splices of some of samples in the internet.

#include <TimeAlarms.h>
#include <TimeLib.h>

void setup()
{

pinMode(LED_BUILTIN, OUTPUT);

// create the alarms
Alarm.alarmRepeat(8,30,0, MorningAlarm); // 8:30am every day

}

void loop(){
Alarm.delay(100);

}

void MorningAlarm(){
Serial.println("Alarm: - turn pumps off/on");

digitalWrite(LED_BUILTIN, HIGH);// I want this to run over and over untill let say 14:00:00
Alarm.delay(1000);
digitalWrite(LED_BUILTIN,LOW);

}

You could put the code in 'code tags' for a start. That would help.

Then put your blinking led in your loop(). In your MorningAlarm() set a flag that tells you if the alarm has gone off. In the loop() check for the 'alarmHasGoneOff' flag and only blinky the led when that is true.

Jimmy

thank you sir Jimmy. I am new to arduino, but i'll try to absorb your inputs and terms and rebuild my code.

Give it a try and post back here, many people will be ready to help.

here is my first newbie trial code.

#include <Time.h>
#include <TimeAlarms.h>
#include <TimeLib.h>
#include <RTClib.h>
#include <DS1307RTC.h>

void setup()
{

pinMode(LED_BUILTIN, OUTPUT);

Serial.begin(9600);
setTime(8,29,0,1,1,11); // set time to Saturday 8:29:00am Jan 1 2011 Temporary
while (!Serial) ; // wait until Arduino Serial Monitor opens
setSyncProvider(RTC.get); // the function to get the time from the RTC
if(timeStatus()!= timeSet)
Serial.println("Unable to sync with the RTC");
else
Serial.println("RTC has set the system time");
//rtc 1 close

// create the alarms
Alarm.alarmRepeat(8,30,0, MorningAlarm); // 8:30am every day

}

void loop(){
Alarm.delay(100);
digitalClockDisplay();
Alarm.delay(1000); // wait one second between clock display
if (hour()==8 && minute()==30 && second()==0)
{
digitalWrite(LED_BUILTIN, HIGH);
Alarm.delay(1000);
digitalWrite(LED_BUILTIN,LOW);
Alarm.delay(1000);
}
else if (hour()==8 && minute()==40 && second()==0)
{
digitalWrite(LED_BUILTIN,LOW);
}

else
{
digitalWrite(LED_BUILTIN, HIGH);
Alarm.delay(1000);
digitalWrite(LED_BUILTIN,LOW);
Alarm.delay(1000);
}

// functions to be called when an alarm triggers:

}
void MorningAlarm(){
Serial.println("Alarm: - turn pumps off/on");

if (LED_BUILTIN==HIGH)
{digitalWrite(LED_BUILTIN,LOW);
Alarm.delay(1000);}
else
{digitalWrite(LED_BUILTIN,HIGH);
Alarm.delay(1000);}

}

void digitalClockDisplay()
{
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
}

void printDigits(int digits)
{
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}

this code works when compiled, there seems to be no error, but the output keeps on blinking even at the beginning of time.