I'm send rs232 command Hex to temp&humidity sensor follow up manual. but the result not work
Dim data As Byte() = {&H1, &H4, &H0, &H1, &H0, &H1, &H60, &HA}
SerialPort1.Write(data, 0, 8)
Result In manual = 0x131
my program = 01 04 02 01 2B F8 BF
What I have tried:
Private Sub SerialPort1_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
'ReceivedText(SerialPort1.ReadExisting())
Dim Count As Integer = SerialPort1.BytesToRead
Dim Buffer(0 To Count - 1) As Byte
Dim Text2Display As String = ""
SerialPort1.Read(Buffer, 0, Count)
For I As Integer = 0 To Buffer.GetUpperBound(0)
Text2Display += Buffer(I).ToString("X2") & " "
Next
ReceivedText(Text2Display)
End Sub
Private Sub ReceivedText(ByVal [text] As String)
If Me.rtbReceived.InvokeRequired Then
Dim x As New SetTextCallback(AddressOf ReceivedText)
Me.Invoke(x, New Object() {(text)})
Else
Me.rtbReceived.Text &= [text] & vbNewLine
End If
End Sub
End Class