Hello, I want to make a garden irrigation system. Irrigation will start every Sunday at 12 o'clock and end at 12:15. This cycle will continue constantly. How can I solve the timing issue here? I want to do it without using if else to avoid tiring the processor.
an if else does not get the processor tired. Feel free to use it
how do you plan to know it's Sunday and the time of the day?
I think the processor always check the condition. It will be tired. I will use millis function. I will increase a some counter let say x. X will represent hour. when x increased +1 millis function will set as 0 and then start the count again. when x is equal to 168 the interrupt will work and water will be given to garden from a water stroge area by using water pump motor or water will be given from main water line by using servo motor.
Is there any better idea to solve this problem ?
Nice of you to think that but it won't
(in the same way it won't get tired counting milliseconds)
millis() won't be stable enough over weeks to keep an accurate timing
You need a way to get the time like an RTC or if WiFi and Internet is available, you could get time from an NTP server
Hello nysia1
Use a simple timer from the DIY store.
Where is the fun ![]()
And where I live a simple timer will not work
Two hours "no power" and your timer is two hours behind ![]()