2017년 3월 30일 목요일

Sending data and text to a terminal problem ?


I have been testing a few buttons to send data and text to a Bluetooth HC05 module the App is running on a S7 phone and the  terminal program on a windows 7 laptop  , the problem I'm getting is I cant make sense of the data I'm getting in the terminal window the only button that seems to be outputting the right data is the 0 it don't matter what terminal programs I use the results are the same . the Terminal window is set to show hexadecimal data which it is showing but as you can see by this picture its not right. 170 in hexadecimal is AA and 255 is FF so what am I missing ? the errors are not random they are always the same numbers. I'm very new to App inventor so any help would be great.

--
A very strange result. I've never sent over Bluetooth to my PC, so I thought I'd try it & used an existing AppInventor App, with the AI Companion.

1. I use Teraterm and when set to receive characters NORMALLY, it receives strings like "on" correctly (the old purpose of the App).
2. However, when I put Teraterm into Hex mode, I get a different result - "on" should come across as 4E 4F, but comes across as 6E 6F other than seeing that an extra bit is set - I don't understand.why
3. If I send Byte value 170, I do get AA


Teraterm behaves differently to your emulator; I have no idea why.

AppInventor IS sending correctly; the terminal emulator is doing something wierd.

-- 
Thanks for having a look Neil, can you recommend a better way of testing the output of my app ? The app I'm working on will be sending the data to a picmicro via a HC 05 Bluetooth module, I just wanted to work on and debug the app before I started building and debugging the picmicro end but maybe I should start on that now and use that to test the app ?

-- 
My App was aimed at an Arduino Uno, with an HC06 Bluetooth Adapter; all it did was switch an LED connected to the Aduino, on and off.

Once I got the hang of Blutetooth pairing, I found it pretty easy to go straight to that.
Here's a link to my blog posting, if you want to look at it:

You might find it helpful.

-- 
Thank you I will have a look

-- 
Well I have tried a few terminal emulator programs and I get garbage out of everyone. I don't have a clue why this is the case :( I have tested the usb to serial module and that is working fine,  could it be the HC05 Bluetooth module ? I cant see why that would be messing up the data ?  I'm thinking I should start looking at using another platform to build my apps because it really is starting to look like its a problem with the App inventor, my app must not be sending out the right data :(

-- 
Did you also try to send data to the picmicro? There are plenty of examples of apps using HC-06 or HC-05 together with all kinds of Arduino boards which work just fine.
App Inventor allows you to experiment with your app quite easily, then if it seems to work, you can still switch to another platform. The problem is usually not App Inventor but the sketch on your Arduino.

-- 
Thanks for taking the time to reply Ghica, I was just coming back here to say I found the problem and it was just a simple case of the wrong baud rate for some reason the module is set to 19200 when all the data I have tells me it should be 9600, so now I have worked that out I can now send data to my phone from the laptop and also receive data from the phone. but I still can not get the module to respond to any AT commands I have set the baud rate 38400 and powered the unit up with the button pressed in therefore hold pin 34 high, I have also tried all the other baud rates without success. it don't help that I've never worked with Bluetooth modules before but I'm getting slowly :)
-- 
Nice to hear that something at least works!
If you want further help, you could attach a screenshot of your relevant blocks and the relevant part of your sketch in the picmicro.

-- 
Glad to see you are making some progress.

There seem to be at least 2 different versions of the HC05 around, which require a slightly different approach to accessing the AT commands.


and


I recollect struggling with  HC05 a few years ago.

-- 
Thanks Ghica I will do

-- 
Thanks Neil I will have a look at those links


-- 
I just wanted to say I got the HC-05 module working with the help from one of those links Neil so again thanks very much for your help.

--
Excellent news!

Happy to help

--

댓글 없음:

댓글 쓰기