I'm having some troubles using the time info taken from the UDP server.
I'm setting a timer to water the plants two times a day.
I'm trying to call a function (water) at a specific time but it is not working.
Any help?
void Night() {
int nowHour;
nowHour=hour();
int nowMinutes;
nowMinutes=minute();
int nowSeconds;
nowSeconds=second();
if (nowHour==21&&nowMinutes==59&&nowSeconds==40){
Water();
}
}
Alarm.alarmRepeat(21,26,30, Night);This calls the Night() function at 21:26:30 each day. Why then does the Night() function check to see whether the time is something different ?
if (nowHour==21&&nowMinutes==59&&nowSeconds==40){
Water();
}
Actually i've tried both ways separatelly.
The alarm function for some reason does not trigger the function so i've tried the other option but it did not work.
I'll try to clean The code and post it Like you suggested.
It is a safeguard to ensure that the water() function only gets called once when the time to water matches the current time. Probably not a problem when the timing is to the second but imagine what might happen if the timing was being done only to the minute, particularly if the water() function is non blocking, which it should be.