Here is another problem...
The RepeatTask (15 sec) alarm working fine but MorningAlarm wont't work at all
I checked several times but I see nothing wrong?
Any Idea?
Code:
#include <Wire.h>
#include "RTClib.h"
#include <Time.h>
#include <TimeAlarms.h>
RTC_DS1307 RTC;
int led = 13;
void setup(){
Serial.begin(57600);
Serial.println("One timer is triggered every 15 seconds");
Serial.println("The timer is triggered once a day");
Serial.println();
pinMode(led, OUTPUT);
Wire.begin();
RTC.begin();
if (!RTC.begin()) {
Serial.println("RTC failed");
while(1);
}
Alarm.alarmRepeat(9,9,00, MorningAlarm); // change time
Alarm.timerRepeat(15, RepeatTask);
}
void loop(){
//DateTime now = RTC.now();
digitalClockDisplay();
Alarm.delay(1000);
}
void RepeatTask()
{
Serial.println("15 second timer");
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
Alarm.delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
Alarm.delay(1000);
}
void MorningAlarm()
{
Serial.println("Single timer");
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
Alarm.delay(2000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
Alarm.delay(1000);
}
void digitalClockDisplay()
{
DateTime now = RTC.now(); // digital clock display of the time
if(now.hour()< 10)Serial.print("0");
Serial.print(now.hour(),DEC);
Serial.print(":");
if(now.minute ()< 10)Serial.print("0");
Serial.print(now.minute(),DEC);
Serial.print(":");
if(now.second ()< 10)Serial.print("0");
Serial.print(now.second(),DEC);
Serial.println();
}