mem, your sketch works great.
But, when I add your sketch to my sketch and add EEPROM library there are something wrong.
Can I place this code (below) in void loop()? not in void setup().
Alarm.alarmRepeat(19,54,0, MorningAlarm);
Alarm.alarmRepeat(19,55,30,EveningAlarm);
repeatTimer = Alarm.timerRepeat( 1 * SECS_PER_MIN, RepeatTask);
my purpose to place the code in void loop() are i can change "start, interval and stop alarm" parameters from VB anytime and save it to EEPROM.
So, if Arduino Power is OFF I don't have to set "start, interval and stop alarm" parameters.
I have tried my idea and the alarm can't be disabled.
this is the part of my sketch:
#include <Time.h>
#include <TimeAlarms.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t
#include <EEPROM.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 7, 13, 12, 11, 10);
AlarmID_t doRingIntS1;
void loop()
{
compareAlarmInt();
Alarm.delay(0);
....
}
void compareAlarmInt()
{
char c = EEPROM.read (200); //hourEEPROM ==>1//START HOUR
char d = EEPROM.read (201); //minuteEEPROM ==>1//START MINUTE
char e = EEPROM.read (202); //hourEEPROM ==>1//STOP HOUR
char f = EEPROM.read (203); //minuteEEPROM ==>1//STOP MINUTE
char g = EEPROM.read (204); //hourEEPROM ==>1//INTERVAL HOUR
char h = EEPROM.read (205); //minuteEEPROM ==>1//INTERVAL MINUTE
Alarm.timerRepeat(c, d, 0, StIntSlave1); //==start alarm mode interval slave 1
Alarm.timerRepeat(e, f, 0, EndIntSlave1); //==End alarm mode interval slave 1
g = g * 60;
h = h + g;
alarmIntervalSlave1 = Alarm.timerRepeat( h * SECS_PER_MIN, doRingIntS1 );
}
/*====================INTERVAL ALARM SLAVE 1, START and STOP/END =================*/
void StIntSlave1(){
Alarm.enable(alarmIntervalSlave1);
}
void EndIntSlave1(){
Alarm.disable(alarmIntervalSlave1);
}
/*====================INTERVAL SLAVE 1 COMMAND=================*/
void doRingIntS1(){
lcd.setCursor(0,1);
lcd.print("bip..bipp..bip..");
delay(3000);
lcd.clear();
}
...
...
...
any suggestion,mem?
thanks,
.nug.