Пример #1
0
        public int Run(LcdDevice device, KnightRiderOptions opts)
        {
            device.ClearScreen();
            int x = 0, y = 0;

            using (new Timer(state =>
            {
                var oldX = x;
                var oldY = y;
                if (y == 0)
                {
                    x += 4;
                }
                else
                {
                    x -= 4;
                }
                if (x >= 13)
                {
                    x = 12;
                    y++;
                }
                else if (x < 0)
                {
                    x = 0;
                    y--;
                }
                if (device.Connected)
                {
                    device.SendDataToLcd(x, y, "\0\0\0\0");
                    device.SendDataToLcd(oldX, oldY, "    ");
                }
            }, null, 0, 200))
            {
                Console.WriteLine("Press any key to stop...");
                Console.ReadKey();
                if (device.Connected)
                {
                    device.ClearScreen();
                }
            }
            return(0);
        }
Пример #2
0
 public int Run(LcdDevice device, ClearOptions opts)
 {
     device.ClearScreen();
     return(0);
 }