'Non-UI application (console application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Private myserial As Serial
Private astream As AsyncStreams
Private uart_list As List
Private sndStr As String
Private rcvStr As String
End Sub
Sub AppStart (Args() As String)
myserial.Initialize("")
uart_list = myserial.ListPorts
myserial.Open(uart_list.Get(0))
myserial.SetParams(115200,8,1,0)
astream.Initialize(myserial.GetInputStream,myserial.GetOutputStream,"astream")
Log("Initialized")
StartMessageLoop
End Sub
Sub astream_NewData (Buffer() As Byte)
rcvStr = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
sndStr = "I have received " & rcvStr & Chr(13) & Chr(10)
Log(sndStr)
astream.Write(sndStr.GetBytes("UTF8"))
End Sub