Hi:
I've tried the B4R Bluetooth example with the B4J Bluetooth example program and I have strange results sending numbers or string from B4R to B4j
B4R
B4J
When received the stream on PC, if the sended stream is a string - "AT+FLAG"-, buffer contains the ASCII codes of each character of the string, but if the sended stream is a number (0,1,...), the buffer contains the number not the ASCII code of the number (so BytestoString -UTF8- doesn't work)
I've tried to change at Arduino (byte to String) but I didn't find how to do it, which is the best way? (obviously, I can control the buffer value and add the value to the corresponding ASCII value)
Another question, is possible to configure astream in prefix mode?? I receive the string stream on PC in several streams (I'll ve to implement a function to implement EOT on Arduino and read it on PC)
I've tried the B4R Bluetooth example with the B4J Bluetooth example program and I have strange results sending numbers or string from B4R to B4j
B4R
B4X:
count=1
Log ("Sending =",count)
astream.Write(Array As Byte(count))
astream.Write("AT+FLAG".GetBytes)
B4J
B4X:
Sub AStream_NewData (Buffer() As Byte)
Log ("Buffer " & Buffer.Length & " Buffer =" &Buffer (0))
Log ("Buffer to String "&BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
End Sub
When received the stream on PC, if the sended stream is a string - "AT+FLAG"-, buffer contains the ASCII codes of each character of the string, but if the sended stream is a number (0,1,...), the buffer contains the number not the ASCII code of the number (so BytestoString -UTF8- doesn't work)
B4X:
Buffer 1 Buffer =1
Buffer to String
Buffer 1 Buffer =65
Buffer to String A
Buffer 7 Buffer =84
Buffer to String T+FLAG
Another question, is possible to configure astream in prefix mode?? I receive the string stream on PC in several streams (I'll ve to implement a function to implement EOT on Arduino and read it on PC)