Android Question Split data on WriteLine

Ayabonga

Member
Hello guys,

I want to send a command to my MCU along with its data but i want to split the data because its from 3 different/separate textboxes but currently its writing everything in one line.
Instead of writing 789 to MCU i want to seperate it three values like:
7
8
9
Please also check the screenshot of MCU
BLUETOOTH MCU CODE.PNG

B4X:
[CODE=b4x]Sub btn_Execute_Click

    If connected Then

        Hennyval = Hennytxt.Text

        Sodaval = Sodatxt.Text

        Remmyval = Remytxt.Text

        TextWriter1.WriteLine("!Execute " & Remmyval & Hennyval & Sodaval & "#" ) 'send the command protocol to the Microcontroller through serial port.

        TextWriter1.Flush                                                         'clear the serialport TX buffer to make sure the previous string gets sent.



  I tried this but need to press the button 3 times and I want to press it once.   



        'TextWriter1.WriteLine("!Henny #")
        'TextWriter1.WriteLine("!Execute " & Remmyval & "#" )
        'TextWriter1.WriteLine("!Execute " & Hennyval & "#" )
        'TextWriter1.WriteLine("!Execute " & Sodaval & "#" )
        

    End If
[/CODE]
code.
 

Ayabonga

Member
Code is wrong. Don't use TextWriter with network communication.
You should use AsyncStreams or AsyncStreamsText.
Thank you. I added the AsyncSteamsText module but i am not sure how to use it. I want to send text from the app to my MCU (NUCLEO-F446RE) using HC-06 bluetooth module. It works but the problem i have it put all these texts(numbers) from 3 textboxes into 1 line. How can I separate these texts?
 
Upvote 0
Top