示例#1
0
        private static void RotateMatrix(NusbioMatrix matrix, int deviceIndex)
        {
            Console.Clear();
            ConsoleEx.TitleBar(0, "Rotate Demo");
            ConsoleEx.WriteMenu(0, 2, "Rotate:  L)eft  R)ight  Q)uit");

            matrix.Clear(deviceIndex);
            matrix.CurrentDeviceIndex = deviceIndex;
            matrix.DrawLine(0, 0, 0, matrix.Height, true);
            matrix.DrawLine(7, 0, 7, matrix.Height, true);
            matrix.DrawLine(0, 2, matrix.Width, 2, true);
            matrix.WriteDisplay(deviceIndex);

            while (true)
            {
                var k = Console.ReadKey(true).Key;
                switch (k)
                {
                case ConsoleKey.Q: return; break;

                case ConsoleKey.L: matrix.RotateLeft(deviceIndex); break;

                case ConsoleKey.R: matrix.RotateRight(deviceIndex); break;
                }
                matrix.WriteDisplay(deviceIndex);
            }
        }
示例#2
0
        private static void DrawAxis(NusbioMatrix matrix, int deviceIndex)
        {
            ConsoleEx.Bar(0, ConsoleUserStatusRow, "Draw Axis Demo", ConsoleColor.Yellow, ConsoleColor.Red);

            Console.Clear();
            ConsoleEx.TitleBar(0, "Draw Axis Demo");
            ConsoleEx.WriteMenu(0, 2, "Q)uit");


            matrix.Clear(deviceIndex);
            matrix.CurrentDeviceIndex = deviceIndex;

            matrix.Clear(deviceIndex);
            matrix.CurrentDeviceIndex = deviceIndex;
            matrix.DrawLine(0, 0, matrix.Width, 0, true);
            matrix.DrawLine(0, 0, 0, matrix.Height, true);
            matrix.WriteDisplay(deviceIndex);

            for (var i = 0; i < matrix.Width; i++)
            {
                matrix.SetLed(deviceIndex, i, i, true, true);
            }
            var k = Console.ReadKey();
        }
示例#3
0
        private static void BrightnessDemo(NusbioMatrix matrix, int maxRepeat, int deviceIndex)
        {
            Console.Clear();
            ConsoleEx.TitleBar(0, "Brightness Demo");

            matrix.Clear(deviceIndex);
            matrix.CurrentDeviceIndex = deviceIndex;

            var y = 0;

            for (y = 0; y < matrix.Height; y++)
            {
                matrix.DrawLine(0, y, matrix.Width, y, true);
                matrix.WriteDisplay(deviceIndex);
            }
            matrix.AnimateSetBrightness(maxRepeat - 2, deviceIndex: deviceIndex);
            matrix.Clear(deviceIndex);
        }