Need Help program won't repeat

My program does do whats it is intended to do except it only worked the first time and does not repeat. Can some one tell me what I did wrong?

/*

 */
 
#include <Time.h>
#include <TimeAlarms.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "Wire.h" 
#define DS1307_I2C_ADDRESS 0x68 //set rtc
#include <LiquidCrystal.h>
#define ONE_WIRE_BUS 3 //Define the pin of the DS18B20

const int MorningAlarmPin1 =  A1;    // Blue Lights     
const int MorningAlarm2Pin2 =  A2;   // White Lights
const int MorningAlarm3Pin3 = A3;    // Moon Lights
const int EveningAlarmPin1 =  A1;    // Blue Lights
const int EveningAlarm2Pin2 =  A2;   // White Lights
const int EveningAlarm3Pin3 = A3;    // Moon Lights
int EveningAlarmState = LOW;
int MorningAlarmState = HIGH;             
int MorningAlarm2State2 = HIGH;
int EveningAlarm2State2 = LOW;
int MorningAlarm3State3 = HIGH;
int EveningAlarm3State3 = LOW;
int heater = A4;           // pin to power up relay
int heater_on_temp = 78;   //Turn on heater at this temp
int heater_off_temp = 80;  //turn heater off once below this temp

LiquidCrystal lcd( 8, 9, 4, 5, 6, 7);

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
void HeaterOn()
{
  digitalWrite(heater, LOW);  
  //lcd.setCursor(9, 1);
 // lcd.print("ON ");    
}


/*|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  D E F I N E  :  H E A T E R    O F F |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
void HeaterOff()
{
  digitalWrite(heater, HIGH);
  //lcd.setCursor(9, 1);
 // lcd.print("OFF");
    
    
}

void setup()
{
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  setTime(7,14,00,2,9,14); // set time to Saturday 8:29:00am Jan 1 2011
  // create the alarms 
  Alarm.alarmRepeat(7,15,0, MorningAlarm);  // Time Blue's come on every day
  Alarm.alarmRepeat(7,18,0,EveningAlarm);   // Time Blue's shut off every day 
  Alarm.alarmRepeat(7,16,0, MorningAlarm2); // Time White's come on
  Alarm.alarmRepeat(7,17,0,EveningAlarm2);  // Time White shut off
  Alarm.alarmRepeat(7,17,0, MorningAlarm3); // Time moon come on
  Alarm.alarmRepeat(7,19,0,EveningAlarm3);  // Time Moon shut off
  pinMode(MorningAlarmPin1, OUTPUT);     // set the digital pin as output:
  pinMode(MorningAlarm2Pin2, OUTPUT);    // set the digital pin as output:
  pinMode(EveningAlarm2Pin2, OUTPUT);    // set the digital pin as output:
  pinMode(EveningAlarmPin1, OUTPUT);     // set the digital pin as output:
  pinMode(EveningAlarm3Pin3, OUTPUT);    // set the digital pin as output:
  pinMode(MorningAlarm3Pin3, OUTPUT);    // set the digital pin as output:
  pinMode(heater, OUTPUT);               // set the digital pin as output:
   sensors.begin();   
}

void  loop(){
   
  digitalClockDisplay();
  Alarm.delay(1000); // wait one second between clock display
 // DS18B20 display 
sensors.requestTemperatures(); // Send the command to get temperatures 
  lcd.setCursor(9, 0); 
  lcd.print(sensors.getTempFByIndex(0));  
  lcd.print((char)223); 
  if (sensors.getTempFByIndex(0) < heater_on_temp)  HeaterOn();  
  if (sensors.getTempFByIndex(0) > heater_off_temp)  HeaterOff(); 
  lcd.setCursor(9, 0); 
  delay(1000);   
}

// functions to be called when an alarm triggers:
void MorningAlarm(){
  lcd.setCursor(0,0);
  lcd.print("BL ON");
  if (MorningAlarmState == HIGH)
      MorningAlarmState = LOW;
    else
      MorningAlarmState = HIGH;
    digitalWrite(MorningAlarmPin1, MorningAlarmState);
  
    
}
void MorningAlarm2(){
  lcd.setCursor(0,1);
  lcd.print("WH ON"); 
 if (MorningAlarm2State2 == HIGH)
      MorningAlarm2State2 = LOW;
    else
      MorningAlarm2State2 = HIGH;
    digitalWrite(MorningAlarm2Pin2, MorningAlarm2State2); 
}
void MorningAlarm3(){
  lcd.setCursor(8,1);
  lcd.print("MOON ON"); 
 if (MorningAlarm3State3 == HIGH)
      MorningAlarm3State3 = LOW;
    else
      MorningAlarm3State3 = HIGH;
    digitalWrite(MorningAlarm3Pin3, MorningAlarm3State3); 
}

void EveningAlarm(){
  lcd.setCursor(0,0);
  lcd.print("BL OFF");
  if (EveningAlarmState == HIGH)
      EveningAlarmState = LOW;
    else
      EveningAlarmState = HIGH;
    digitalWrite(EveningAlarmPin1, EveningAlarmState);
}

void EveningAlarm2(){
  lcd.setCursor(0,1);
  lcd.print("WH OFF"); 
if (EveningAlarm2State2 == HIGH)
      EveningAlarm2State2 = LOW;
    else
      EveningAlarm2State2 = HIGH;
    digitalWrite(EveningAlarm2Pin2, EveningAlarm2State2);
  
}
void EveningAlarm3(){
  lcd.setCursor(8,1);
  lcd.print("MOON OFF"); 
if (EveningAlarm3State3 == HIGH)
      EveningAlarm3State3 = LOW;
    else
      EveningAlarm3State3 = HIGH;
    digitalWrite(EveningAlarm3Pin3, EveningAlarm3State3);
  
}

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

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

except it only worked the first time and does not repeat

Could you explain this!.

Mark

Jh123456789:
it only worked the first time and does not repeat.

I'm guessing you mean that the clock displays the correct time, and each alarm triggers at the expected time on the first day but doesn't trigger again on subsequent days. Is that it?

I'm not entirely sure what you want the alarms to do but the comments suggest that you want each LED to come on at one time and go off at another time. The code does something much more complicated - each alarm handler seems to invert the last state output by that handler. In other words each output would come on every other day, and go off every other day. If you just want the LEDs to go on (or off) when the alarm triggers, get rid of all the MorningAlarmState and similar variables and just have each alarm handler call digitalWrite to set the corresponding pin to the right state.

Sorry, the lights will only come on the first time I program it and then nothing the second day. Ok, I am new at this so back to the drawing board. Thanks for the help.

If you can tell us what it is you want it to do and what it does then maybe we can help. Start over again but dump all the alarms/timers and do it with blink without delay much simpler!. Those timer lib's are just not worth the effort.

Mark

Part of my program monitors temp and turns a heater on and off which is working fine. The other part is suppose to send power to A1, A2, and A3 on my board which controls relays and sends power to my lights. The program needs to repeat daily. Any suggestions are appreciated.