Page 2 of 2

Re: bluetooth eblock connection

Posted: Fri Mar 11, 2011 4:05 pm
by stephenmccarthy
Hi,
David thanks for sorting out this thread for me,

Ben thanks for the reply,
I am just wondering that if for what i want to accomplish should I have to fiddle with the AT commands in the bluetooth macro as I am able to connect my code to hyperterm but hyperterm has never responded to commands, like AT returning OK?

Thanks
Stephen

Re: bluetooth eblock connection

Posted: Fri Mar 11, 2011 5:39 pm
by Benj
Hello,

I'm not sure if you can send AT commands via the wireless. Eg via hyperterminal. Have you tried connecting to the other COM port that is provided when installing the remote bluetooth device.

Re: bluetooth eblock connection

Posted: Fri Mar 11, 2011 6:18 pm
by stephenmccarthy
Hi Ben,

Yes I tried the other COM port it connects, but i dont think to the bluetooth component as the LED on the component does not light.
The first thing i done to my code was include a bluetooth initilize command, followed by send script 1. It works it allowed a conection.
Funnnily enough i just threw in a creat command and a send command loaded both with the same value and compiled to the chip to see if hyperterminal would react. It did. With a smiley face.. So atleast I know its capable of getting some reaction to my code.
I am just wondering now for the send command should the bExpectEcho(BYTE) value be the same as the bExpectCR(BYTE) value?
I had a look at some example programs but thry mainly seem to be using strings.
Thanks
Stephen

Re: bluetooth eblock connection

Posted: Mon Mar 14, 2011 12:44 pm
by stephenmccarthy
Hi Ben,

I have a set up the Bluetooth and i can now communicate with hyperterm i can send a message to hyper term saying ""YOUR_HEART_RATE=" followed by the BPM value, the problem is instead of printing a number it prints a symbol i.e instead of "YOUR_HEART_RATE=6" it prints "!", any idea on how i can fix this, i am sending the BPM value as a byte, but it is the same case when i send as an int?

Thanks
Stephen

Re: bluetooth eblock connection

Posted: Mon Mar 14, 2011 1:29 pm
by Benj
Hello Stephen,

Ok here you will need to convert your numeric byte into a string representing the number you wish to send.

On the PIC you can do this using the string manipulation icon and the ToString function. You would then simply send the string over the bluetooth rather then the byte variable.

Re: bluetooth eblock connection

Posted: Mon Mar 14, 2011 3:29 pm
by stephenmccarthy
Hi Ben,

Thanks for the reply, I have converted my value to a string, however i cannot find parameter in the bluetooth macro that accepts strings? Am i missing something?
As far as I know string receive and string send is the correct way too send strings.

Thanks,
Stephen

Re: bluetooth eblock connection

Posted: Mon Mar 14, 2011 4:40 pm
by Benj
Hello,

Ah yes you are correct you can only send a byte at a time using the Bluetooth component.

In this cas eyou will have to convert the number to a string as detailed previously and then output the string to the Bluetooth a byte at a time.

To do this you simply create two byte variables, one to hold the length of the string and the other to hold the current position in the string.

To read the string length use the length function available from the string manipulation icon.

Once you have the string length initialise your position variable to 0 and then enter a loop while position < length.

Inside the loop to send a byte from the string you can use this syntax.

string[position]

then increment the position byte.

position = position + 1

Re: bluetooth eblock connection

Posted: Tue Mar 15, 2011 12:56 pm
by stephenmccarthy
Hi Ben,

I just seen your reply, I actually tried somnething similar to what you outlined , last night, But I was not succesful. I even tried shouting at it...... this didnt work either :)
I noticed the bluetooth is very sensitive to the send command if i set it up in a way it dosent like it will refuse to connect to hyperterminal atall,

I just tried implementing your idea but I dont think I have it quiet right, could you please view the attached code and let me know what corrections I need to make?

Thanks
Stephen

Re: bluetooth eblock connection

Posted: Tue Mar 15, 2011 1:08 pm
by Benj
Hello Stephen,

I have made amendments to your file and it should work correctly now.

Re: bluetooth eblock connection

Posted: Tue Mar 15, 2011 2:01 pm
by stephenmccarthy
Hi Ben

Thanks yet again for another quick reply,
I just downloaded your updated code and cleaned up the send command and now it works.
Thanks very much for your time, there is no way I would have managed to get the bluetooth component working with your help,
I will keep this thread up to date on the progress of this project over the coming weeks,

Thanks again!!
Stephen