Receiving input from the BA - in VB

A while back I started a topic for Sending input from a program I created in VB. Not to long ago did I get that to work finally. Now I want to receive input through the Serial Port.

So, does anyone know exactly how you do this?

Maybe :slight_smile:

You do it more or less the same way. Except on the VB side you might use something like a s = com1.ReadLine() to get a string back on the PC. Note you might have to experiment some to see if any extra lines are generated that you need to read and ignore. Here is an partial example of some code I had working with the brat:

[code] Using com1 As IO.Ports.SerialPort = _
My.Computer.Ports.OpenSerialPort(ComLB.Items(ComLB.SelectedIndex), BaudCB.Items(BaudCB.SelectedIndex))
’ Output special Count to tell Host Brat that we would like the
’ downloaded sequence returned to us.
com1.Handshake = IO.Ports.Handshake.None
com1.WriteLine(-42)
System.Threading.Thread.Sleep(200)
Try
com1.ReadTimeout = 2000 'wait a maximum of 2 seconds for a response
s = com1.ReadLine()
s = com1.ReadLine()
cnt = Val(s)
Catch ex As Exception
For iItem = 1 To 100
Beep()
Next

                cnt = -1
            End Try
  [/code]

On the Brat side, you simply need to do serouts. You might have to experiment to see if both CR and LFs are needed. An example output on my brar:

		serout s_out, i2400, [dec GhcCnt, 13, 10]

I hope that helps.

Kurt

Sorry it took me so long Kurte, I’m having a hard time reinstalling VB. As soon as I get it installed I’ll try this out. Thanks!