CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    83

    Communication with BlueTooth Device over Serial Port

    Hi

    I have recently purchased a BlueTooth device from SparkFun, and have managed to get it to work using Hyperterminal.

    I would like to use my own VC++ written program instead of Hyperterminal.
    I have managed to read/ write RS232 serial data before, and the BlueTooth device communciates serially.

    Right now I have managed to:
    (a) Using Hyperterminal send commands to start up the BT device.
    Commands such as "ATUCL<cr>", etc
    (b) Once the connection is established- I close Hyperterminal and start up my own VC++ program.
    (c) I can then send over the RS232 line a "start command" (not requiring a <cr> and a "stop command" (Also not requiering a <cr>)
    I can receive data over the RS232 line and display it.
    (d) What I CANNOT do is to send "ATUCL<cr>" type of commands over the RS232. It just does nothing.

    Can someone please tell me how to send a

    ATUCL<cr>

    into the RS232 serial port?

    (I have tried, using \n \r and both \n\r with no success).

    Thank you in advance.
    a.

  2. #2
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Re: Communication with BlueTooth Device over Serial Port

    have a look on this may be this one Help you
    http://www.codeguru.com/forum/showth...09#post1377409

    Thankyou

  3. #3
    Join Date
    Aug 2004
    Location
    Bucharest, Romania... sometimes
    Posts
    1,039

    Re: Communication with BlueTooth Device over Serial Port

    Have you tried "\r\n" instead of "\n\r" ?
    Bogdan Apostol
    ESRI Developer Network

    Compilers demystified - Function pointers in Visual Basic 6.0
    Enables the use of function pointers in VB6 and shows how to embed native code in a VB application.

    Customize your R2H
    The unofficial board dedicated to ASUS R2H UMPC owners.

  4. #4
    Join Date
    Mar 2005
    Posts
    83

    Re: Communication with BlueTooth Device over Serial Port

    Hi

    Yes I have tried both combinations of "\r\n" and "\n\r"

    What is the exact characters for:
    AT<cr>

    is it "AT\n\r"?

    and is \n\r 2 characters or one?

    Thank you
    a.

  5. #5
    Join Date
    Sep 2005
    Location
    Singapore
    Posts
    8

    Re: Communication with BlueTooth Device over Serial Port

    You can refer to ASCII Chart in MSDN library for RS-232 communication.

    If you send character '\x00D', it is equilvalent to <CR>.

    \x mean Hexadecimal and 00D is the ASCII number equivalent to <CR>.

  6. #6
    Join Date
    Mar 2005
    Posts
    83

    Re: Communication with BlueTooth Device over Serial Port

    Hi zawthet

    Thank you- that worked!

    All the best
    a.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured