示例#1
0
        static void Main(string[] args)
        {
            if (!SC18IM700.Open("COM7"))
            {
                Console.WriteLine("COM Port Open Failed");
                return;
            }

            if (!SC18IM700.AllPortModeWrite(0b11111111))
            {
                Console.WriteLine("Port Setting Failed");
                SC18IM700.Dispose();
                return;
            }

            while (true)
            {
                if (SC18IM700.TryAllPortRead(out byte data))
                {
                    var a = (byte)~data;
                    Console.WriteLine(format: "PORT={0}", arg0: a.ToString());
                }

                Task.Delay(1000).Wait();
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            if (!SC18IM700.Open("COM7"))
            {
                Console.WriteLine("COM Port Open Failed");
                return;
            }

            if (!SC18IM700.AllPortModeWrite(0b00000000))
            {
                Console.WriteLine("Port Setting Failed");
                SC18IM700.Dispose();
                return;
            }

            var a = (byte)0b00000001;

            while (true)
            {
                for (var i = 0; i < 7; i++)
                {
                    SC18IM700.AllPortWrite(a);
                    Task.Delay(100).Wait();
                    a <<= 1;
                }

                for (var i = 0; i < 7; i++)
                {
                    SC18IM700.AllPortWrite(a);
                    Task.Delay(100).Wait();
                    a >>= 1;
                }
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            if (!SC18IM700.Open("COM7"))
            {
                Console.WriteLine("COM Port Open Failed");
                return;
            }

            if (!SC18IM700.PortModeWrite(0, SC18IM700GpioMode.Output) ||
                !SC18IM700.PortModeWrite(7, SC18IM700GpioMode.Input))
            {
                Console.WriteLine("Port Setting Failed");
                SC18IM700.Dispose();
                return;
            }

            while (true)
            {
                if (!SC18IM700.TryPortRead(7, out SC18IM700GpioState value))
                {
                    continue;
                }

                if (value == SC18IM700GpioState.Low)
                {
                    SC18IM700.PortWrite(0, SC18IM700GpioState.High);
                }
                else
                {
                    SC18IM700.PortWrite(0, SC18IM700GpioState.Low);
                }
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            if (!SC18IM700.Open("COM7"))
            {
                Console.WriteLine("COM Port Open Failed");
                return;
            }

            if (!SC18IM700.PortModeWrite(0, SC18IM700GpioMode.Output))
            {
                Console.WriteLine("Port Setting Failed");
                SC18IM700.Dispose();
                return;
            }

            while (true)
            {
                SC18IM700.PortWrite(0, SC18IM700GpioState.High);
                Task.Delay(500).Wait();
                SC18IM700.PortWrite(0, SC18IM700GpioState.Low);
                Task.Delay(500).Wait();
            }
        }