how to talk with VB and know the data?

can anyone point a tutorial about talking to visual basic using arduino? btw, i use VB studio 2010..

second question, by using arduino we can know that a certain number is what we need, example, in PING sensor we can sent out data such as 55 cm, 34 cm and so on.. but in VB, are we able to know if that data is the range from PING sensor or do the serial data sent to vb is different from what i get in arduino?

thank you..

http://www.arduino.cc/playground/Main/InterfacingWithSoftware
There is a link here for VB .NET.

but in VB, are we able to know if that data is the range from PING sensor or do the serial data sent to vb is different from what i get in arduino?

The serial data send to the serial port is the serial data sent to the serial port, regardless of whether or not there is anything on the other end of the port, and regardless of what is on the other end of the serial port.

If random bytes being sent to the serial port are not sufficient, you should create packets, like <Distance: xxx>, instead of just writing xxx to the serial port.

so by doing this

  Serial.print("range : ");
  Serial.print(range);
  Serial.print(" cm");
  Serial.println();

the output expected from serial monitor in arduino is xxx cm…

so by defining the data sent as I can search and get the xxx only? is there any example that i can learn on how to get the specific number from serial??

the link you had given tells that to use VB with arduino we can use firmata. but in firmata the form of VB is already defined, if i want to create my own form, how is it possible? by seeing the firmata code i can’t understand which line should i use to connect arduino with VB…

thank you…

so by doing this

Code:
Serial.print(“range : “);
Serial.print(range);
Serial.print(” cm”);
Serial.println();

the output expected from serial monitor in arduino is xxx cm…

No. The output that will appear on the Serial Monitor (and in the VB application that you will write) will be range : xxx cm.

I can search and get the xxx only?

The xxx can be extracted from the string. Whether you have the skills to do it, I don’t know.

is there any example that i can learn on how to get the specific number from serial??

I don’t think any Arduino examples, written in C++, are you going to help you write an application on the PC using Visual Basic.

As I recall, though, there is a boat load of help available in Visual Basic. Just motivate your finger over to the F1 key, and do some searching.

Use the Mid() function in VB to extract the value you want from the string.

Remember that Visual Basic will interpret all incoming serial data to ASCII. You must be careful that if you want to send ASCII digits, use the print(range,DEC). That may be the default for integers and doubles, but it won’t be for anything stored in raw BYTE data.

I did something in VB 2008 the other day that read bytes from the USB and did some work on them. The following is a cut down snippet.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       [glow]c = SerialPort1.ReadByte()[/glow]
End Sub

   Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        If SerialPort1.IsOpen() Then
            SerialPort1.Close()
        End If

    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SerialPort1.PortName = "Com33" ' use your COM # here
        SerialPort1.Open() ' defaults to 9600, change in the properties?

    End Sub

Assumes a serial object has been dropped onto the form.

Put the code to parse the incoming string where the highlighed part is.

As for the Arduino code, there’s no point sending formatting strings, just send the data

Serial.print("<");
Serial.print(range);
Serial.print(">");

Then as already mentioned use Mid() to extract the data.


Rob

Hi all,

[u]My working setup[/u]: proximity sensors connected to serial arduino and arduino connected to router.

[u]My working application[/u]: remotely ( wirelessly) control the arduino using the router through visual basic 6.0

Question: How will make my sensors feedback to visual basic that it has detected anything? So as to alert the user. Like the arduino reading the sensor and sending back the data to visual basic through the router

Code Reference: http://www.jbprojects.net/projects/wifirobot/

Help :-X

The code I posted above will receive data from the Arduino via the serial port and USB, I'm sorry I have no idea about how to talk to a router.


Rob