1个回答
展开全部
用SerialPort
SerialPort _Serial = new SerialPort
{
PortName = "COM1",
BaudRate = 9600,
DataBits = 8,
Parity = Parity.None,
StopBits = StopBits.One,
WriteTimeout = SerialPort.InfiniteTimeout,
ReadTimeout = SerialPort.InfiniteTimeout,
Handshake = Handshake.None,
ReadBufferSize = 1024
};
_Serial.DataReceived += new SerialDataReceivedEventHandle(Serial_DataReceived);
_Serial.Open();
在
private void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
//在这里写接收到数据时的处理
...
}
SerialPort _Serial = new SerialPort
{
PortName = "COM1",
BaudRate = 9600,
DataBits = 8,
Parity = Parity.None,
StopBits = StopBits.One,
WriteTimeout = SerialPort.InfiniteTimeout,
ReadTimeout = SerialPort.InfiniteTimeout,
Handshake = Handshake.None,
ReadBufferSize = 1024
};
_Serial.DataReceived += new SerialDataReceivedEventHandle(Serial_DataReceived);
_Serial.Open();
在
private void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
//在这里写接收到数据时的处理
...
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家国内优质海外HTTP代理商,拥有一个庞大的IP资源池,覆盖200多个地区,IP数量大且匿名度高。其优点还包括超高并发、稳定高效、技术服务等特点,同时提供HTTP、HTTPS以及SOCKS5协议支持。此外,Sto...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询