Ayabonga Member Jun 20, 2020 #1 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 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.
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 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.
Erel B4X founder Staff member Licensed User Longtime User Jun 21, 2020 #2 Code is wrong. Don't use TextWriter with network communication. You should use AsyncStreams or AsyncStreamsText. Search Results www.b4x.com Upvote 0
Code is wrong. Don't use TextWriter with network communication. You should use AsyncStreams or AsyncStreamsText. Search Results www.b4x.com
Ayabonga Member Jun 21, 2020 #3 Erel said: Code is wrong. Don't use TextWriter with network communication. You should use AsyncStreams or AsyncStreamsText. Search Results www.b4x.com Click to expand... 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
Erel said: Code is wrong. Don't use TextWriter with network communication. You should use AsyncStreams or AsyncStreamsText. Search Results www.b4x.com Click to expand... 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?
Erel B4X founder Staff member Licensed User Longtime User Jun 22, 2020 #4 The simplest way to do it is to develop the Arduino app with B4R and then use B4RSerializator. https://www.b4x.com/search?query=B4RSerializator Code: Dim s As String = $"${EditText1.Text},${EditText2.Text},${EditText3.Text}"$ Upvote 0
The simplest way to do it is to develop the Arduino app with B4R and then use B4RSerializator. https://www.b4x.com/search?query=B4RSerializator Code: Dim s As String = $"${EditText1.Text},${EditText2.Text},${EditText3.Text}"$