My first post and just want to say Blynk is awesome!
I’m using an ESP8266 to control a sprinkler system on a timer. I’m using the RTC widget instead of a physical RTC to track real time and I want to use the TimeAlarm library to trigger sprinkler events at specific times.
The problem is in my setup:
/******** Connect Blynk ***********/
Blynk.begin(auth, xxx, xxx);
while (Blynk.connect() == false)
{}// Wait until connected
rtc.begin();
// Rear Sprinkler Times
SprinkAlarm1 = Alarm.alarmRepeat(7,50,0, sprinkler1);
SprinkAlarm1 = Alarm.alarmRepeat(21,00,00, sprinkler1);
// Front Sprinkler Times
SprinkAlarm2 = Alarm.alarmRepeat(6,30,00, sprinkler2);
SprinkAlarm2 = Alarm.alarmRepeat(20,30,00, sprinkler2);
As it is, the Sprinklers do not trigger. If I get rid of the rtc.begin and replace with a constant:
setTime(7, 49, 0, 3, 3, 2016); // any date works
Then the alarm works
If I change to
rtc.begin();
setTime(hour(), minute(), second(), 4, 4, 2016); // any date works
it triggers all four alarms at startup (which is not what I want!), but then it triggers the proper alarm at the proper time.
If I change the set time to
setTime(hour(), minute(), second(), day(), month(), year());
or
setTime(now());
The alarm doesn’t work.
I can work around it by putting an if statement in the loop section:
if (hour() == 8 && minute() == 2 && second() == 30)
{sprinkler1();}
But I’d rather declare the alarms at the setup and have it work
Any help is very much appreciated! Thanks