Example #1
0
        static void Main(string[] args)
        {
            SerialPort com = new SerialPort("COM3", 19200, Parity.None, 8, StopBits.One);
            com.ReadTimeout = 100;
            SerialPortBinaryConnection sbc = new SerialPortBinaryConnection(com);
            BinaryServiceHelper svc = new BinaryServiceHelper(sbc);

            Console.Write("Initializing... ");
            while (!svc.IsStarted)
            {
                try
                {
                    svc.Start();
                }
                catch (Exception)
                {
                }
            }
            Console.WriteLine("done.");

            try
            {
                TestPixel(svc).Wait();

                TestFill(svc, new CubeColor()
                    {
                        R = 0,
                        G = 0xFF,
                        B = 0
                    }).Wait();
                TestPixels(svc).Wait();

                TestFill(svc, new CubeColor()
                {
                    R = 0,
                    G = 0,
                    B = 0
                }).Wait();
            }
            catch (AggregateException ex)
            {
                Console.WriteLine( ex.InnerException.ToString());
                Console.ReadKey();
            }
            
            svc.Stop();
            svc.Dispose();
            sbc.Dispose();
            com.Dispose();
        }