Serial data to Visual Basic, Visual C++, Java

If you use Visual Basic, communicating with the Arduino is pretty simple stuff.

  1. Add the object Microsoft Comm Control 6.0 to your project, and put it on the form.

  2. Set the correct properties for MSComm1 (baud-rate, com-port, etc.) This depends on your Arduino-code and your computer setup.

  3. Add the following code to the Form_Load() event (double click the form):

Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub
  1. Add a Timer to your form (the small clock-symbol-thingie) and set it's interval to something like 100ms (Interval: 100)

  2. 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
  1. 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"