Tricky one...It was coming back over the script so fast that the mod 20 was running repeatedly. Since I do things on odd/even minutes mine does not run into that issue. I put in a check to make sure we are not still on the same second as the last transition and it ran fine with my lights for over an hour before I stopped it.
void Start() {
Off(All);
//***********************************************************************************************
DateTime now = DateTime.Now; //Gets the current time
ChannelCollection whiteLights;
ChannelCollection multiLights;
//*********************************************************************************************
whiteLights = Channels(Left_Magnolia___White,Right_Bradford___White);
multiLights = Channels(Left_Magnolias___Red___Multi,Right_Bradford_Pear___Red___Multi);
//*********************************************************************************************
int whiteOn;
int transitionSecond;
whiteOn = 0;
transitionSecond = 0;
//*********************************************************************************************
while (true) <= 0)
{
if (now.Second % 20 == 0 && now.Second != transitionSecond)
{
transitionSecond = now.Second;
if (whiteOn == 0)
{
Ramp(Channels(multiLights), 60, 0, Over (10).Seconds);
Ramp(Channels(whiteLights), 0, 60, Over (10).Seconds);
whiteOn = 1;
}
else
{
Ramp(Channels(whiteLights), 60, 0, Over (10).Seconds);
Ramp(Channels(multiLights), 0, 60, Over (10).Seconds);
whiteOn = 0;
}
}
now = DateTime.Now; //update the current time
}
}