satwar Posted May 19, 2016 Share 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 Link to comment
oberkc Posted May 19, 2016 Share 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) Link to comment
larryllix Posted May 20, 2016 Share Posted May 20, 2016 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 Link to comment
satwar Posted May 20, 2016 Author Share Posted May 20, 2016 Thank you so very much gentlemen, very elegant. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.