I’m trying to update to SerialConnectiion from Serial and I’m not there yet. The port connection is not right. This is a very simplistic connection I’m trying to establish:
Find Port:
[code]Var i As Integer
Var PortName as string
For i = 0 To System.SerialPortCount-1
if System.SerialPort(i).Name = “usbserial-A50285BI” then
CurrentPort = i 'Global Property
PortName = System.SerialPort(i).Name
end
next
Return PortName[/code]
Old Serial code that worked fine:
Var SBuffer As String
Me.port = CurrentPort
Me.baud = 8
If open Then
WriteSerial "reset"
pause (10)
SBuffer = ReadAll(Encodings.ASCII)
End
New SerialConnection Code that needs help:
[code]Var SBuffer As String
Me.device = CurrentPort REM PROBLEM SEEMS TO BE WITH DEVICE=CURRENTPORT
Me.baud = 8
Me.connect
Catch error As IOException
MessageBox(“The serial connection could not be opened.”)
WriteSerial “reset”
pause (10)
SBuffer = Me.ReadAll(Encodings.ASCII)[/code]