예제 #1
0
 public void OnStart(W32Serial ser)
 {
     ser.WriteComm(new W32Serial.SerWriteInfo
     {
         buf = new byte[] { 0xA5, 0x60 }
     });
 }
예제 #2
0
        static void WriteStr(W32Serial ser, string str)
        {
            var buf = ASCIIEncoding.ASCII.GetBytes(str + "\n");

            ser.WriteComm(new W32Serial.SerWriteInfo
            {
                buf  = buf,
                Done = (ok, err) =>
                {
                    Console.WriteLine("err " + ok);
                }
            });
        }
예제 #3
0
        static void Main(string[] args)
        {
            foreach (var pn in SerialPort.GetPortNames())
            {
                Console.WriteLine(pn);
            }
            W32Serial ser = new W32Serial();

            ser.Open("COM3", 9600);
            ser.Start(new Capp());
            WriteStr(ser, "D1");
            while (true)
            {
                var str = Console.ReadLine();
                WriteStr(ser, str);
            }
        }
예제 #4
0
 public void OnStart(W32Serial ser)
 {
 }