Hi Darrel,
I've not had chance to test this yet, but here's how I've adapted the code
The one thing I'm not too clear on, given that I have two sets of start times and end times for the two lighting circuits, do I need to change the PastStop and Paststart to something like PastStop[fn] and PastStart[fn] to match the same lightoff[nf] etc ?Code:TimeCmpFlags = 0 ; clear flags first ; if the Start and Stop times are the same, then Always OFF if (lightsetHR[fn]=timeH) AND _ (lightsetMN[fn]=timeM) then AlwaysOFF ; is it past the Start time? if (timeH>lightsetHR[fn]) OR _ (timeH=lightsetHR[fn] AND timeM>lightsetMN[fn])then PastStart=1 ; is it past the Stop time? if (timeH>lightoffHR[fn]) OR _ (timeH=lightoffHR[fn] AND timeM>lightoffMN[fn])then PastStop=1 ; does the period end the following day? if (lightoffHR[fn]< lightsetHR[fn]) OR _ (lightoffHR[fn]=lightsetHR[fn] AND lightoffMN[fn] < lightsetMN[fn]) then NextDay=1 ' endif ;--------------- if !NextDay then ; same day, use AND if PastStart AND !PastStop then ProgON = 1 else ; next day, use OR IF PastStart OR !PastStop then ProgON = 1 endif AlwaysOFF: Lights1 = 0 Lights2 = 0 'turn off the light if lights1 = 0 and lights2 = 0 then LCDOut $FE, $94+9," " endif return




Bookmarks