Go Down

Topic: Serial data to Visual Basic, Visual C++, Java (Read 8 times) previous topic - next topic

pd2kplus10

 Hello all,

  I'm interested in sending serial data from an arduino to my PC and have it displayed on either VB,VC++ or Java program. I'm not sure which one would be easiest to do. I would like to be able to make a simple program rather quickly ... nothing too fancy.
I just need to display a reading from one sensor.


thanks,
Phil

hotcarrier

You might try Processing at http://processing.org/. It uses much the same IDE as the Arduino and is similar in many other respects. There are many examples on the Forum and elsewhere to provide the capability you are seeking.

PlastBox

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):
Code: [Select]
Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub


4. Add a Timer to your form (the small clock-symbol-thingie) and set it's interval to something like 100ms (Interval: 100)

5. Add the following code to the timer (double click the timer-object on the form)
Code: [Select]
Private Sub Timer1_Timer()
If MSComm1.InBufferCount > 0 Then
   Dim buf as string
   buf = MSComm1.Input
End If
End Sub


6. To send data back to the Arduino, you place the following code in your program (in a button_Click() event or something like that)
Code: [Select]
MSComm1.Output "whatever you want to send"
Dreaming of extra senses through sensory substitution/agumentation since.. well, for ever.. =P
Going to automate my home, just gotta find the perfect DIY solution first!

pd2kplus10

  Thanks guys for the help. I think for now I'm going to start with Processing. It seems to be a lot easier to work with. I would like to play around with some VB & C++ , but I don't think I'm ready for it at the moment.

 Thanks for the code Plastbox. That was very helpful. The only thing is ... I don't have VB 6.0 .. I have the free VB 2008 Express. I don't think it has MS Comm. It does have SerialPort.



thanks,
Phil

PlastBox

Aaah, ok. I just assumed VB6 as it is by far the most easy windows environment and language to get started with. Also, people whine constantly about the performance and such of programs made with VB6. Up yours, people! When one is talking about small utility-applications and stuff like that, performance doesn't even come into play.  ;)
Dreaming of extra senses through sensory substitution/agumentation since.. well, for ever.. =P
Going to automate my home, just gotta find the perfect DIY solution first!

Go Up