public void MySerialPortStart() { myComm.OpenSerialPort(); for (int i = 0; i < 2; i++) { Console.ReadLine(); myComm.Send("sss 订单"); } for (int i = 0; i < 2; i++) { byte[] myBytes = Encoding.UTF8.GetBytes("sss 订单"); Console.ReadLine(); myComm.Send(myBytes); } //for (int i = 0; i < 3; i++) //{ // Console.ReadLine(); // Console.WriteLine(myComm.ReadAllStr()); //} for (int i = 0; i < 3; i++) { Console.ReadLine(); byte[] tp = myComm.ReadAllBytes(); if (tp != null) { Console.WriteLine(Encoding.UTF8.GetString(tp)); } else { Console.WriteLine("null"); } } }
public bool ExecutionDeviceConnect() { isConnect = mySerialPort.OpenSerialPort(); return(isConnect); }