Hi
I am new to Basic4Android. I am a C++ programmer.
I am trying to use a Samsung Galaxy II to connect an instrument on serial Port. I use the SerialExample program with some modification, taking away the timer mechanism and just sending a simple Command (actually an "A") to the instrument. The instrument should answer with an Ascii string. All the data exchange has to be done with Ascii characters. My first test is done with the debugger, and, being the instrument rather "slow" to answer (the answer is not immediate), I send the command and stop the program (with the debugger) allowing the instrument "some time" to answer.This is only very first manual experiment, but, in my opinion, some chars should appear on the Serial port. Instead nothing appears. Can anybody tell me something about?
Thanks in advance.
Giovanni
The code is:
Sub btnSend_Click
If connected Then
Dim s As String
s="A"
TextWriter1.WriteLine(s)
TextWriter1.Flush
Read ' this is actually the renamed timer function
End If
End Sub
Sub Read ' old timer function
If connected Then ' here I wait "a little", to allow the instrument to answer
If TextReader1.Ready Then ' this never happens....
txtLog.Text = txtLog.Text & TextReader1.ReadLine & CRLF
txtLog.SelectionStart = txtLog.Text.Length
End If
End If
End Sub
I am new to Basic4Android. I am a C++ programmer.
I am trying to use a Samsung Galaxy II to connect an instrument on serial Port. I use the SerialExample program with some modification, taking away the timer mechanism and just sending a simple Command (actually an "A") to the instrument. The instrument should answer with an Ascii string. All the data exchange has to be done with Ascii characters. My first test is done with the debugger, and, being the instrument rather "slow" to answer (the answer is not immediate), I send the command and stop the program (with the debugger) allowing the instrument "some time" to answer.This is only very first manual experiment, but, in my opinion, some chars should appear on the Serial port. Instead nothing appears. Can anybody tell me something about?
Thanks in advance.
Giovanni
The code is:
Sub btnSend_Click
If connected Then
Dim s As String
s="A"
TextWriter1.WriteLine(s)
TextWriter1.Flush
Read ' this is actually the renamed timer function
End If
End Sub
Sub Read ' old timer function
If connected Then ' here I wait "a little", to allow the instrument to answer
If TextReader1.Ready Then ' this never happens....
txtLog.Text = txtLog.Text & TextReader1.ReadLine & CRLF
txtLog.SelectionStart = txtLog.Text.Length
End If
End If
End Sub