I have been an Inst tech for a long time and know the hardware side, however , I am very weak on the programming side.
My project. To create an auto curtain opening and closing .
Functionality/ program sequence :-
- Must be able to manually open/close the curtains at ANY time.
- To auto run the curtains ONLY between certain times ie 1200-1900 ( I know this requires an RTC)
- Auto run action to be triggered by the sun shining on an LDR
- If manually opened DURING the period where the auto function is enabled - Must be able to override the LDR. ie No good opening the curtain and then the LDR automatically closes it again.
- Additional feature : At midnight IF closed to automatically open again.
I have already written the manual open/close sketch with error checking for human error .
I have already sorted out how to use the RTC
I have already written a sketch to get the LDR to work the servo drive.
The hardware side is already done and working.
I just cant put all of the above into a sequence.
Do I use if then else if or some other logical action ie case switch. The more I think about it the less I can come up with a way to do it.
Any help appreciated.