Esempio n. 1
0
        private static async Task Set(ITLC5947 tlc, Color color, ConsoleColor cc, CancellationToken cancellationToken)
        {
            int          x     = Console.CursorLeft;
            int          y     = Console.CursorTop;
            ConsoleColor oldcc = Console.BackgroundColor;

            try
            {
                Console.SetCursorPosition(0, 0);
                Console.BackgroundColor = cc;
                Console.Write(" ");
            }
            finally
            {
                Console.BackgroundColor = oldcc;
                Console.SetCursorPosition(x, y);
            }
            tlc.SetLED(0, color);
            tlc.Write();
            //await Task.Delay(333, cancellationToken);
        }
 /// <summary>
 /// Set RGB led color (for a 12 bits PWM)
 /// </summary>
 /// <param name="comp">The component</param>
 /// <param name="ledNum">LED number</param>
 /// <param name="color"></param>
 public static void SetLED(this ITLC5947 comp, int ledNum, Color color)
 {
     comp.SetLED(ledNum, color.R, color.G, color.B);
 }