/// <summary> /// 写入数据到串口 /// </summary> /// <param name="route"></param> public static void WriteToPort(string route) { byte[] bys = HexHelper.ToHexByte(route); if (sp != null && sp.IsOpen) { for (int i = 0; i < 3; i++) { sp.Write(bys, 0, bys.Length); Thread.Sleep(50); } } }