S StarinschiAndrei Active Member Licensed User Longtime User Feb 17, 2019 #1 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): i use as a reference , Erel's Bluetooth app example. Code: 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
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): i use as a reference , Erel's Bluetooth app example. Code: 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
Erel B4X founder Staff member Licensed User Longtime User Feb 18, 2019 #2 The usage of Asc here looks wrong. Asc expects a single character and returns its unicode point value (same as ASCII). Upvote 0
The usage of Asc here looks wrong. Asc expects a single character and returns its unicode point value (same as ASCII).
S StarinschiAndrei Active Member Licensed User Longtime User Feb 18, 2019 #3 Erel said: The usage of Asc here looks wrong. Asc expects a single character and returns its unicode point value (same as ASCII). Click to expand... 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
Erel said: The usage of Asc here looks wrong. Asc expects a single character and returns its unicode point value (same as ASCII). Click to expand... 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
Erel B4X founder Staff member Licensed User Longtime User Feb 18, 2019 #4 StarinschiAndrei said: and this was the sent command : 01 25 F8 45 30 05 30 31 39 37 03 Click to expand... Code: AStream.Write(Array As Byte(0x01, 0x25, 0xF8, 0x45, 0x30, 0x05, 0x30, 0x31, 0x39, 0x37, 0x03 )) Upvote 0
StarinschiAndrei said: and this was the sent command : 01 25 F8 45 30 05 30 31 39 37 03 Click to expand... Code: AStream.Write(Array As Byte(0x01, 0x25, 0xF8, 0x45, 0x30, 0x05, 0x30, 0x31, 0x39, 0x37, 0x03 ))
S StarinschiAndrei Active Member Licensed User Longtime User Feb 18, 2019 #5 Erel said: Code: AStream.Write(Array As Byte(0x01, 0x25, 0xF8, 0x45, 0x30, 0x05, 0x30, 0x31, 0x39, 0x37, 0x03 )) Click to expand... Thank you. It is working . But now i should see why the connection is broken after the command is sent. Upvote 0
Erel said: Code: AStream.Write(Array As Byte(0x01, 0x25, 0xF8, 0x45, 0x30, 0x05, 0x30, 0x31, 0x39, 0x37, 0x03 )) Click to expand... Thank you. It is working . But now i should see why the connection is broken after the command is sent.
S StarinschiAndrei Active Member Licensed User Longtime User Feb 24, 2019 #6 Hi, Is there any function that can convert hex 15e in 30 31 35 3E ? I tried to use Code: dim val as string '15e Log(bc.HexFromBytes (bc.StringToBytes(val,"UTF8"))) but the result is : 313565 Upvote 0
Hi, Is there any function that can convert hex 15e in 30 31 35 3E ? I tried to use Code: dim val as string '15e Log(bc.HexFromBytes (bc.StringToBytes(val,"UTF8"))) but the result is : 313565
Erel B4X founder Staff member Licensed User Longtime User Feb 25, 2019 #7 Please start a new thread for a new question. Upvote 0