static void Main(string[] args) { csjSerialPort.csjSerialPort mySerialPort = new csjSerialPort.csjSerialPort("com4"); mySerialPort.Open(); int cnt = 0; while (true) { byte[] b = new byte[10]; for (int i = 0; i < b.Length; i++) { b[i] = (byte)(cnt % 100); } mySerialPort.Send(b); Thread.Sleep(1); cnt++; } //mySerialPort.DataReceived += new csjSerialPortDataReceived(getBuffer); }
static void Main(string[] args) { #if debug string s = "132.2323234 32.323423"; for (int i = 0; i < s.Length; i++) { Console.WriteLine(i.ToString() + ":" + Convert.ToInt32(s[i]).ToString()); } byte[] b = Encoding.UTF8.GetBytes(s); string str = Guid.NewGuid().ToString(); Console.WriteLine(str.Length); //Console.WriteLine(Encoding.Unicode.GetString(b)); #else csjSerialPort.csjSerialPort mySerialPort = new csjSerialPort.csjSerialPort("com6"); mySerialPort.Open(); mySerialPort.DataReceived += new csjSerialPortDataReceived(getBuffer); #endif Console.ReadKey(); mySerialPort.Close(); }