I have been working on a project for my greenhouse using a arduino uno and a day1307 RTC to switch on/off the lights at a particular time which is set using 3 push buttons. I have got the buttons working and i can set the time using them. I also connected a output pin to a relay which is working perfectly using switch cases.
In India, and particularly where I live, we have a lot of power failures which makes a simple task of using the timer difficult.
Where an I stuck : I have read about the bool/boolean function and i have set a relay state for the relay. In the relay stage, i have compared the now.hour() to the timeron function and set a relay state according.
I have also made a checkrelaystatus function where i am using the eepron value of the last saved state and comparing that yo the current state when the arguing fires up again. This is where I am stuck.
Anyone out there has a better solution of doing it. I will post my code tomorrow as we are out of power again and I am using my phone to write this post :