If you use Visual Basic, communicating with the Arduino is pretty simple stuff.
-
Add the object Microsoft Comm Control 6.0 to your project, and put it on the form.
-
Set the correct properties for MSComm1 (baud-rate, com-port, etc.) This depends on your Arduino-code and your computer setup.
-
Add the following code to the Form_Load() event (double click the form):
Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub
-
Add a Timer to your form (the small clock-symbol-thingie) and set it's interval to something like 100ms (Interval: 100)
-
Add the following code to the timer (double click the timer-object on the form)
Private Sub Timer1_Timer()
If MSComm1.InBufferCount > 0 Then
Dim buf as string
buf = MSComm1.Input
End If
End Sub
- To send data back to the Arduino, you place the following code in your program (in a button_Click() event or something like that)
MSComm1.Output "whatever you want to send"