public void ConnectCom(string addIP) { try { Ch.OpenCommSerial(Convert.ToInt32(addIP), -1); EnableMotor(0); EnableMotor(1); EnableMotor(2); } catch (COMException ex) { Console.WriteLine(ex.ToString()); } }
public override bool?Connect(string path, ConnectMode mode) { switch (mode) { case ConnectMode.IP: Ch.CloseComm(); Ch.OpenCommEthernetTCP(path, Ch.ACSC_SOCKET_STREAM_PORT); return(true); case ConnectMode.Com: Ch.CloseComm(); Ch.OpenCommSerial(Convert.ToInt32(path), -1); return(null); } return(null); }