please help me WITH VB6 sensor values

hi people .
anyone knows how to transfer 4 different values at the same time from sensors from arduino to visual basic 6?
ex: i have 4 values from sensors

2,43 3,40 8,50 0,82 this is my sensor values from arduino analog input pins A1 A2 A3 A4

now i need to read all these values from visual basic 6 in 4 different textbox

anyone knows how?

thank you marializia.

You could send the data from the Arduino with code like this

Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker

Your PC program will see it as "<123.45,87.65> and after stripping off the start and end markers the data will be in CSV format for which there is almost certainly a ready-made parsing function.

...R

once you have the data in CSV format as Robin suggests you can use String.Split and Integer.TryParse methods to obtain the numeric values which you can then place TextBox components, e.g.

        Dim s As String = "<2.43,3.40,8.50,0.82>"
        Dim words As String() = s.Split("<,>".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
        For i As Integer = 0 To words.Length - 1
            Dim value As Double
            If Double.TryParse(words(i), value) Then
                Console.WriteLine(words(i))
            Else
                Console.WriteLine("Error! string '" + words(i) + "' is not a Double")
            End If
        Next

gives

2.43
3.40
8.50
0.82
Press any key to continue . . .

I would change the separator :wink: OP uses ',' for decimals. Maybe use a pipe or tab.

If one wants to keep the comma as the separator, use the format

"2,43","3,40","8,50","0,82"

first of all thank you all for your reply :slight_smile:
this is the code i end with
timer1_timer()
Dim aa
Dim bb
Dim cc
Dim firstData
Dim secondData
aa = Text1.Text
bb = Text1.Text
cc = Text1.Text
aa = Left$(aa, 10)
bb = Left$(bb, 20)
cc = Right(cc, 5)
firstData= Left(cc, 6)
secondData= Right(bb, 1)
Label1.Caption = firstData+ secondData
'Label2.Caption = secondData

end sub

cyprusmari:
first of all thank you all for your reply :slight_smile:
this is the code i end with

Good to hear you have a solution.

...R