VB和aeduino中波特率都设置为9600,VB能够正常接收数据,看起来一样,但数据判断却不一样。。。。
VB中代码:
Dim buf$
Dim DR$
DR = Trim("DATA:CREADY")
buf = Trim(MSComm1.Input)
Label15.Caption = buf
Label16.Caption = DR
If LCase(buf) = LCase(DR) Then
MsgBox ("校准完成!")
Else
MsgBox ("校准失败!")
End If
buf = ""
End If
arduino中的代码:
char data = char(Serial.read());
if (data=='A')
{
//Serial.println(data);
delay(5000);
Serial.print("DATA:CREADY \r \n");
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);