code VB:
Code:
Dim dulieu As String
Dim a, b As Integer
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
MSComm1.PortOpen = True
''MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,8,1"
End Sub
Private Sub Option1_Click()
If (Option1.Value = True) And (Option2.Value = False) Then
a = 1
ElseIf (Option1.Value = False) And (Option2.Value = True) Then
a = 2
End If
End Sub
Private Sub Option2_Click()
If (Option1.Value = True) And (Option2.Value = False) Then
a = 1
ElseIf (Option1.Value = False) And (Option2.Value = True) Then
a = 2
End If
End Sub
Private Sub Text1_Change()
MSComm1.Output = Right(Text1.Text, 1)
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then ''left
MSComm1.Output = "l"
ElseIf KeyCode = 38 Then ''up
MSComm1.Output = "u"
ElseIf KeyCode = 39 Then ''right
MSComm1.Output = "r"
ElseIf KeyCode = 40 Then ''down
MSComm1.Output = "d"
ElseIf KeyCode = 13 Then ''enter
MSComm1.Output = "`"
End If
End Sub