Hi experts,
I need getting string data streaming from my external RS232 device by using the IOIO uart method. I searched around forum but not found exact solution. Present, I can connect to IOIO board and calling openUart but I can't get data streaming, I attached code and diagram as below. Appreciated much for all reply.
I need getting string data streaming from my external RS232 device by using the IOIO uart method. I searched around forum but not found exact solution. Present, I can connect to IOIO board and calling openUart but I can't get data streaming, I attached code and diagram as below. Appreciated much for all reply.
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim yoyo As IOIO 'IOIO V1.7
Dim uart1 As Uart
Dim in1 As InputStream
Dim out1 As OutputStream
Dim TimerRX As Timer
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Button1 As Button
Private Button2 As Button
Private Button3 As Button
Private Button4 As Button
Private lbStatus As Label
Private txtRX As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
yoyo.Initialize (True)
yoyo.WaitForConnect ()
Msgbox("connected","")
End Sub
Sub Button2_Click
yoyo.Disconnect
End Sub
Sub Button3_Click
uart1=yoyo.OpenUart (5,uart1.IP_FLOATING ,4,uart1.OP_NORMAL,9600,uart1.PARITY_NONE ,uart1.STOPBIT_ONE )
in1=uart1.InputStream
out1=uart1.OutputStream
TimerRX.Initialize("TimerRX",100)
TimerRX.Enabled=True
End Sub
Sub Button4_Click
uart1.Close
in1.Close
out1.Close
End Sub
Sub TimerRX_Tick()
If in1.BytesAvailable>0 Then
TimerRX.Enabled=False
Log ("IN")
End If
TimerRX.Enabled=True
End Sub