using UnityEngine;
using System.Collections;
using System.Collections.Generic;//队列
using System.IO;
using System.IO.Ports;
using System.Threading;//线程
using System;
using System.Text;//16进制转换
public class com : MonoBehaviour {
SerialPort myport;
public string ComNum;
public int irate;
bool isSend = false;
public StringBuilder builder;
public string myDataReceived="";
public string myButton="打开串口 ";
public Thread readthread;
public Thread dealdatathread;
Queue<string> datapool;
public float wheelnum;
public float steerangle;
string stroutpool = string.Empty;
int readnum = 0;
float zero;
public float outputangle=0;
public float outputvelocity=0;
float time = 5;
string num = "5";
public GUIStyle style0;
// Use this for initialization
void Start () {
datapool = new Queue<string>();
myport = new SerialPort(ComNum, irate, Parity.None, 8, StopBits.One);
if(!myport.IsOpen) myport.Open();
readthread = new Thread(read);
dealdatathread = new Thread(dealdata);
readthread.Start();
dealdatathread.Start();
}
// Update is called