[VB2008](急)串列通訊程式的問題
我參考MSDN上的從COMPORT上讀取字串
寫了
Module Module1
Sub Main()
Dim Str As String
Str = ReceiveSerialData()
Console.WriteLine(Str)
Console.ReadLine()
End Sub
Function ReceiveSerialData() As String
' Receive strings from a serial port.
Dim returnStr As String = ""
Using com1 As IO.Ports.SerialPort = _
My.Computer.Ports.OpenSerialPort("COM3") '我的sensor在COM3上
Do
Dim Incoming As String = com1.ReadLine()
If Incoming Is Nothing Then
Exit Do
Else
returnStr &= Incoming & vbCrLf
End If
Loop
End Using
Return returnStr
End Function
End Module
可是一直沒讀到東西
請問是我哪裡寫錯呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.73.175.14
→
09/05 17:01, , 1F
09/05 17:01, 1F