Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Left Then
Dim byteOut(64) As Byte
Dim i As Integer
Try
byteOut(0) = Len("Links") + 5 'number bytes in output message
byteOut(1) = &H0 'should be 0 for NXT
byteOut(2) = &H80 '&H0 = reply expected &H80 = no reply expected
byteOut(3) = &H9 'Send Bluetooth
byteOut(4) = &H1 'Box Number - 1
byteOut(5) = Len("Links") + 1 'message size with null terminator
For i = 1 To Len("Links") 'copy bytes into output array
byteOut(i + 5) = Asc(Mid("Links", i, 1))
Next
byteOut(Len("Links") + 6) = &H0 'add null terminator
SerialPort1.Write(byteOut, 0, Len("Links") + 7) 'send message
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
End Sub