public void OnStart(W32Serial ser) { ser.WriteComm(new W32Serial.SerWriteInfo { buf = new byte[] { 0xA5, 0x60 } }); }
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); } }); }
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); } }
public void OnStart(W32Serial ser) { }