Android Question Serial monitor B4J ARDUINO

Veck

New Member
Hello, I'm new to B4X and I have some doubts, I want to do parameter monitoring sent from an arduino by serial communication, my questions are:
How can I receive and display multiple parameters from a serial communication?
What kind of data should be received? (string, char, byte, ascii, hex, ... etc.)

I would really appreciate the help
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private sp As Serial
    Private astream As AsyncStreams
    Private FRECUENCIA As Label
    Private POTENCIA As Label
    Private RPM As Label
    End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("menu") 'Load the layout file.
    MainForm.Show
    sp.Initialize("")
    sp.Open("COM10")
    Dim BaudRate As Int = 9600
    Dim DataBits As Int = 8
    Dim StopBits As Int = 1
    Dim Parity As Int = 0
   
    sp.SetParams (BaudRate , DataBits , StopBits , Parity )
    astream.Initialize(sp.GetInputStream, sp.GetOutputStream, "astream")
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub
Sub AStream_NewData (Buffer() As Byte)
    Dim x As String = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
    Dim y As String = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
    Log(x)
    POTENCIA.Text=x
    FRECUENCIA.Text=y
    RPM.Text=y
End Sub
 
Top