I made a connection from Android to PIC over HC-06. The problem is that I can not send more than 3 characters from my application. I have modified Erel-s Bluetooth tutorial (https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/#content).
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Here my code.
If i type 123 in the txtInput box, then all 3 chars are transfered to PIC. If there are more chars, then only first 3 are transfered.
Comunity, mybee is too hot for thinking but anyway,... thks for help.
			
			
			
				B4X:
			
		
		
		#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
'Activity module
Sub Process_Globals
    Dim AStream As AsyncStreams
End Sub
Sub Globals
    Dim txtInput As EditText
    Dim txtLog As EditText
    Dim btnSend As Button
    Public charset As String = "UTF8"
    Private sb As StringBuilder
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("2")
    If AStream.IsInitialized = False Then
        AStream.Initialize (Main.serial1.InputStream ,Main.serial1 .OutputStream ,"AStream")
    End If
    sb.Initialize
    txtLog.Width = 100%x
End Sub
Private Sub astream_NewData (Buffer() As Byte)
   
    sb.Append(BytesToString(Buffer, 0, Buffer.Length, charset))
    Dim s As String = sb.ToString
   
    Log("S =  " & s)
    Log("SB = " & sb) 
   
    If s.Contains ("*") Then
        LogMessage("PIC  ", s)
        sb.Initialize
        s = ""
    End If
End Sub
Sub Activity_Resume
   
End Sub
Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then
        AStream.Close
    End If
End Sub
Sub txtInput_EnterPressed
    If btnSend.Enabled = True Then btnSend_Click
End Sub
Sub btnSend_Click
    Dim out_mess As String
    out_mess = txtInput.Text & "*"'& CRLF
    Log("Out Mess = " & out_mess)
    AStream.Write2 (out_mess.GetBytes ("UTF8"),0,out_mess.Length)
    txtInput.SelectAll
    txtInput.RequestFocus
    LogMessage("Me", txtInput.Text)
End Sub
Sub LogMessage(From As String, Msg As String)
    txtLog.Text = txtLog.Text & From & ": " & Msg & CRLF
    txtLog.SelectionStart = txtLog.Text.Length
End SubHere my code.
If i type 123 in the txtInput box, then all 3 chars are transfered to PIC. If there are more chars, then only first 3 are transfered.
Comunity, mybee is too hot for thinking but anyway,... thks for help.
 
				 
 
		 
 
		 
 
		 
 
		 
 
		