OK as I couldn't figure the above out I started from scratch (again) and tried this:
Which works, apart from the original problem, in that at midnight the lights come on and stay on, and the temperatures drop to the default drop temperature. My guess is that as both start times and stop times = 00:00 this is what's causing the issue.Code:For fn = 0 to 1 If lightsetHR[fn]<timeH or lightsetHR[fn]>timeH and lightsetMN[fn]<timeM or lightsetMN[fn]>timeM and lightoffHR[fn]<timeH OR lightoffHR[fn]>timeH and lightoffMN[fn]<timeM OR lightoffMN[fn]>timeM Then LCDOut $FE, $94+9," " if fn=0 then Lights1 = 0 if fn=1 then Lights2 = 0 endif If lightsetHR[fn]=timeH and lightsetMN[fn]=timeM then 'compare value of each set time to current time and if matches if fn=0 then Lights1 = 1 if fn=1 then Lights2 = 1 'turn on those light LCDOut $FE, $94+9,"Lights ON" endif next fOR fn=0 to 3 If StartHour[fn]<timeH or StartHour[fn]>timeH and StartMin[fn]<timeM or StartMin[fn]>timeM and StopHour[fn]<timeH OR StopHour[fn]>timeH and StopMin[fn]<timeM OR StopMin[fn]>timeM then 'compare value of each start time to current time and if matches LCDOut $FE, $94," " SetPoints[fn]=normtemp[fn] endif If StartHour[fn]=timeH and StartMin[fn]=timeM then 'compare value of each start time to current time and if matches SetPoints[fn]=Droptemp[fn] 'change the corresponding set point to the drop temperature LCDOut $FE, $94,"Night" endif if StopHour[fn]=timeH and StopMin[fn]=timeM then 'compare value of each stop time to current time and if matches LCDOut $FE, $94," " SetPoints[fn]=normtemp[fn] 'change value back to normal temperature Endif next fn
Anyone able to help come up with a suitable working snippet of code, or tell me why it doesn't work correctly when using DTs code ?




Bookmarks