看板 Visual_Basic 關於我們 聯絡資訊
在這邊ㄧ直接收不到資料 其中出錯的地方都是在 Dim Incoming As String = com1.ReadLine() 後面的com1.ReadLine()這部份 試了好久,還是找不到錯誤 所以來這邊請較ㄧ下 我是用COM1做測試 '將字串傳送至序列埠 Sub SendSerialData(ByVal data As String) ' Send strings to a serial port. Using com1 As IO.Ports.SerialPort = My.Computer.Ports.OpenSerialPort("C OM1") com1.WriteLine(data) End Using 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("C OM1") 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 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.71.22.72
fire2:我是參考這邊的資料http://0rz.net/491pC 05/23 15:10