Hi Guys,
Needs a little more advise to help sort out a small logic issue that I can't get my head round
Following on from my previous threads, I use a word variable counter1 to count the minutes from midnight, and use other variables that are either < = > this counter to turn lights on etc. As the main outputs will come on and off in the same day this counter method works fine, but where the logic falls over is if the on times are pre-midnight, and the off times are post midnight as the counter resets back to zero at midnight. I've therefore tried adding a day counter so that at midnight the variable changes from 0 to 1, and then is reset at mid-day.
This output would normally be on say from any time between 8pm and 11pm one day and then go off any time the next day, for example on at 8pm then off at 12.00 noon next day, so the on time would equal 1200 and off time would be 720. This is what I've tried, but still fails
Code:
if counter1 => sumplighton then
high sump_light
Endif
If sumplightoff < sumplighton and daycount=0 then
LOW sump_light
endif
If sumplightoff < sumplighton and daycount=1 then
high sump_light
endif
IF counter1 => sumplightoff and daycount=0 then
LOw sump_light
Endif
Any help would be appreciated
Bookmarks