问题描述
发送帮助时,我收到hp但 h 12 12 l 123 p 我收到帮助,这意味着在每封信后必须有2个空格
我尝试过:
public void receiveMsg()
receivedMsgTextbox.AppendText(serialPort1.ReadExisting());
private void sendMsgTextbox_KeyPress(object sender,KeyPressEventArgs e)
byte c =(byte)e.KeyChar;
if(c == 0x0D )
c = 0x0A;
serialPort1.WriteLine(sendMsgTextbox.Text);
receiveMsg();
when sending "help" i receive "hp" but "h12e12l123p"i receive "help" which means after every letter the must be 2 space
What I have tried:
public void receiveMsg()
receivedMsgTextbox.AppendText(serialPort1.ReadExisting());
private void sendMsgTextbox_KeyPress(object sender, KeyPressEventArgs e)
byte c = (byte)e.KeyChar;
if(c == 0x0D)
c = 0x0A;
serialPort1.WriteLine(sendMsgTextbox.Text);
receiveMsg();
推荐答案
这篇关于将数据发送到其他设备时,它会收到第一个字母n第4个字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!