Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经通过 com 端口将 Unity 项目连接到 Arduino 板。我在使用时从它接收数据很好SerialPort.ReadLine(),但是,如果我使用SerialPort.ReadExisting()我得到错误:
SerialPort.ReadLine()
SerialPort.ReadExisting()
你调用的对象是空的
我需要使用 ReadExisting,因为我的应用程序无法跟上 Ardunio 板吐出数据的速度。
我已经让 ReadExisting 在 XNA 项目中正常工作,只是在统一项目中使用时我遇到了问题。
任何帮助将不胜感激。
我会使用这个DataReceived事件。然后在事件处理程序中,尝试调用 ReadExisting。我发布的链接有一个例子。
DataReceived