Hello everybody,
i just came across little problem. I have Arduino+ time module+relay with bulb. In code variable "Hod" and "Min" are for hours and minutes from real time module. Variable "hodiny" and "minuty" we set up and present time in hours and mins when Bulb should start light up. Variable "hodinyD" and "minutyD" represent time in hours and mins until the bulb should glow.
For example : we want to bulb light up from 09:15 to 09:35. So we put 09 in "hodiny" and 15 in "minuty" and 09 in "hodinyD" and 35 in "minutyD".
So i thought it might work like it is in code below. But it doesn't work and i don't know why. I put println inside and it's writing "turn on" but relay is not turning on.
And i want to do one thing : when is all variables (hodiny,minuty,hodinyD,minutyD) set to 0 it should be off for all time when is set to 0. In the end it should looks like : When is real time equal to hodiny,minuty turn on bulb and stay turn on, until the real time is equal to hodinyD,minutyD then turn off and stay turn off until real time is again equal to hodiny and minuty.... and repeat this until variables is set to 0 then stay turned off.
So thank you very much for your help.
t = rtc.getTime();//real time
Hod = t.hour;
Min = t.min;
if((Hod==hodiny)&&(Min==minuty)){
do
{
Serial.println("turn on");
digitalWrite(36, HIGH);
} while ((Hod!=hodinyD)&&(Min!=minutyD));
}
else {digitalWrite(36, LOW);}
i just posting part of code becase it's larger project.