public static void SetLed(this IHomeLoggerHardware hardware, Colours color) { switch (color) { case Colours.Red: hardware.SetLed(1, 0, 0); return; case Colours.Green: hardware.SetLed(0, 1, 0); return; case Colours.Blue: hardware.SetLed(0, 0, 1); return; } throw new NotImplementedException($"The colour {color} has not been implemented."); }
void ChangeLeds(object state) { Console.WriteLine($"{DateTime.Now} Changing LEDs"); var color = LedColors.Colors.ToArray()[ledCount]; if (ledCount++ > LedColors.Colors.Count()) { ledCount = 0; } _hardware.SetLed(color); }