Can somebody help me figure this out. I have an Edittext box "txtSend" and I want to be able to type in a number and it get sent out by UART. This code right now will send 83 and I can view it in another edittext box. I would like to be able to type in a number and send it in place of the 83. Sorry, very new at this and I can't figure it out. This is running IOIOLib 1.7. I tried other code using 1.8 and I can't figure that out either. Thanks
B4X:
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
Dim LED As DigitalOutput
Dim LED2 As DigitalOutput
Dim timer1, timer2, 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.
Dim BLED As ToggleButton
Dim ConLED As ToggleButton
Dim label1 As Label
Dim Serial1 As Serial
Dim BTadmin As BluetoothAdmin
Dim conn1=0 As Int
Dim label1, label2 As Label
Dim togglebutton1 As ToggleButton
Dim trouble As Exception
Dim comments As StringBuilder
Dim conn_attemps As Int
Dim uart1 As Uart
Dim outstrm As OutputStream
Dim instrm As InputStream
Dim numdiag As NumberDialog
Dim togglebutton2,ToggleButton3 As ToggleButton
Dim mtserial As Uart
Dim Edittext1 As EditText
Dim txtSend As EditText
End Sub
Sub ToggleButton2_CheckedChange(Checked As Boolean)
'test uart
If YOYO.IsInitialized Then
If YOYO.State="CONNECTED" Then
If Checked Then
'uart order is is rx,spec,tx,spec,baud,pariy,stop
mtserial=YOYO.OpenUart(12,mtserial.IP_FLOATING,13,mtserial.OP_NORMAL,9600,mtserial.PARITY_NONE,mtserial.STOPBIT_ONE)
Dim out As OutputStream
Dim In As InputStream
Dim bufferin(8), bufferout(8) As Byte
Dim temp As String
out=mtserial.OutputStream
In=mtserial.InputStream
'send 83 and read result
bufferin(0)=83 'S
out.WriteBytes(bufferin,0,1)
In.ReadBytes(bufferout,0,1)
temp="result="&Bit.AND(bufferout(0),0xFF)
Edittext1.Text=temp
mtserial.Close
End If
End If
End If
End Sub