satwar Posted May 19, 2016 Posted May 19, 2016 I have a program that controls an outlet to be "on" for 2 hours then "off" for a minute then "on" again for 2 hours etc. If $Allow_to_Run is 1 Then Repeat Every 1 minute Set 'Outlet' On Wait 2 hours Set 'Outlet' Off Else (blank) I would like to enhance the program to only do this 4 times and then set the outlet "off" for 16 hours, then repeat the 2 hour "on/off" cycle again. Thanks in advance for your help
oberkc Posted May 19, 2016 Posted May 19, 2016 Logically, i suppose you could try: If $allowtorun is 1 Then Repeat 4 times Set outlet on wait 2 hours Set outlet off Wait 1 minute Repeat Run next program (then path) Else Halt next program Next program: If Nothing Then Wait 16 hours Run last program (if path)
larryllix Posted May 20, 2016 Posted May 20, 2016 (edited) One program could do it by calling itself If $Allow_to_Run is 1 Then Repeat for 4 times Set 'Outlet' On Wait 2 hours Set 'Outlet' Off Wait 1 minute Repeat 1 times Wait 16 hours Run (if) program.self Else Set 'Outlet' Off Edited May 20, 2016 by larryllix
satwar Posted May 20, 2016 Author Posted May 20, 2016 Thank you so very much gentlemen, very elegant.
Recommended Posts