Android Question Send HEX byte via bluetooth

StarinschiAndrei

Active Member
Licensed User
Longtime User
Hi all,
Could anybody help me what's wrong in my code ! i try to communicate with a device via Bluetooth based on the following description (attached):
upload_2019-2-17_23-44-7.png

i use as a reference , Erel's Bluetooth app example.
B4X:
Public Sub SendMessage (msg As String)
    AStream.Write(Array As Byte(0x01, 0x25, 0xF8, 0x45, 0x30, 0x05, 0x30, Asc(0x31), Asc(0x39), Asc(0x37), 0x03 ))
   
End Sub
 

StarinschiAndrei

Active Member
Licensed User
Longtime User
The usage of Asc here looks wrong. Asc expects a single character and returns its unicode point value (same as ASCII).
Thank you. Could you please tell how should i send the command ?I send the command with the application (under windows) provided by manufacturer. I monitored the port (serial port monitor) and this was the sent command : 01 25 F8 45 30 05 30 31 39 37 03
 
Upvote 0

StarinschiAndrei

Active Member
Licensed User
Longtime User
Hi,
Is there any function that can convert hex 15e in 30 31 35 3E ?
I tried to use
B4X:
dim val as string     '15e
Log(bc.HexFromBytes (bc.StringToBytes(val,"UTF8")))
but the result is : 313565
 
Upvote 0
Top