I'm trying to change color of the light each second, and I am using the following code.
private async void button5_Click(object sender, EventArgs e)
{
var command = new LightCommand();
command.TurnOn().SetColor("BC8F8F");
command.Brightness = 128;
while (true)
{
command.Alert = Alert.Once;
command.TransitionTime = TimeSpan.FromMilliseconds(100);
command.TurnOn().SetColor("0054FF");
command.Alert = Alert.Once;
command.TurnOn().SetColor("BC8F8F");
command.TransitionTime = TimeSpan.FromMilliseconds(100);
var result = await client.SendCommandAsync(command);
}
}
My goal is changing the color alternately between 0054FF and BC8F8F, each second, but when I debug it, only the BC8F8F color appears.
What is the problem with my code?