Hello All.
I'm new to the forum and new to trying to get my head around Android code.
I stumbled across basic4android by chance and after a short while took the plunge and brought it. I must say I am impressed and am starting to learn my way around little by little around work.
Basically I am looking to build and app that interrogates a Bluetooth module (HC-05) and sends it a hex command to generate a response, then displays the returned hex code interpreted as ASCII in various text boxes.
Using the Bluetooth chat application as a starting point and with the tutorials here, I have managed to get the chat app to send out the hex code and receive the response, which when translated is giving me the information I'm requesting. However I am struggling to now find the lines of code I'd need to change this ASCII hex code to readable text.
For example if I send 1C0A I get sent back 33 on one line and 322E34B043 on the 2nd, which is telling me the temperature reading.
The last sub of the chat app;
"Sub LogMessage(From AsString, Msg AsString)
txtLog.Text = txtLog.Text & From & ": " & Msg & CRLF
txtLog.SelectionStart = txtLog.Text.Length
End Sub"
So I'm guessing this is were I need to put another line of code or two, to take the received information and convert to display correctly. Various searches have not shown me anything obvious to try, other than what I already have and due to my newbie nature to Android coding it's taking me longer to work things out. I'm hoping that by working out what I need to do to the chat app, I can apply that knowledge to build the app I am looking for.
I came across this topic;
http://www.b4x.com/android/forum/threads/convert-string-to-ascii.32201/
But have yet to figure out where to apply the changes to make it work for me.
Any help would be greatly appreciated on my exciting adventure of trying to learn the basics of what I'm trying to achieve.
Ian
I'm new to the forum and new to trying to get my head around Android code.
I stumbled across basic4android by chance and after a short while took the plunge and brought it. I must say I am impressed and am starting to learn my way around little by little around work.
Basically I am looking to build and app that interrogates a Bluetooth module (HC-05) and sends it a hex command to generate a response, then displays the returned hex code interpreted as ASCII in various text boxes.
Using the Bluetooth chat application as a starting point and with the tutorials here, I have managed to get the chat app to send out the hex code and receive the response, which when translated is giving me the information I'm requesting. However I am struggling to now find the lines of code I'd need to change this ASCII hex code to readable text.
For example if I send 1C0A I get sent back 33 on one line and 322E34B043 on the 2nd, which is telling me the temperature reading.
The last sub of the chat app;
"Sub LogMessage(From AsString, Msg AsString)
txtLog.Text = txtLog.Text & From & ": " & Msg & CRLF
txtLog.SelectionStart = txtLog.Text.Length
End Sub"
So I'm guessing this is were I need to put another line of code or two, to take the received information and convert to display correctly. Various searches have not shown me anything obvious to try, other than what I already have and due to my newbie nature to Android coding it's taking me longer to work things out. I'm hoping that by working out what I need to do to the chat app, I can apply that knowledge to build the app I am looking for.
I came across this topic;
http://www.b4x.com/android/forum/threads/convert-string-to-ascii.32201/
But have yet to figure out where to apply the changes to make it work for me.
Any help would be greatly appreciated on my exciting adventure of trying to learn the basics of what I'm trying to achieve.
Ian