I have the following code that communicates with an Arduino device through the Serial port:
This is taken from the exaample:
How do I append a CRLF to the Buffer?
I send a text string "AT$I=10", now I must also send a CLF
B4X:
Sub btnSend_Click
If astream.IsInitialized = False Then Return
If EditText1.Text.Length > 0 Then
Dim buffer() As Byte
buffer = EditText1.Text.GetBytes("UTF8")
buffer = buffer
astream.Write(buffer)
EditText1.SelectAll
Log("Sending: " & EditText1.Text)
End If
End Sub
jSerial library
The jSerial library allows you to open and communicate with other devices through the computer COM ports. It can also be used to communicate with Bluetooth devices over a virtual com port. (jBluetooth library is now available: https://www.b4x.com/android/forum/threads/jbluetooth-library.60184/)...
www.b4x.com
I send a text string "AT$I=10", now I must also send a CLF