Results 1 to 7 of 7

Thread: Bluetooth: connect/disconnect/connect a device

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Bluetooth: connect/disconnect/connect a device

    Hi,

    I want to write a small program to connect and disconnect
    a Bluetooth device as often as I want.

    How can I connect and disconnect a Bluetooth device
    with Visual Basic 6?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,480

    Re: Bluetooth: connect/disconnect/connect a device

    Suggest searching this forum. Here's one thread that has links to other sources. Googling may be useful also, until someone responds with definitive, fail-safe, alternate methods.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: Bluetooth: connect/disconnect/connect a device

    Thanks LaVolpe.

    I bought a Bluetooth module ...
    www.ebay.com/itm/271513590642
    It is very tiny(13x26mm), and it has 34pins. When the device is connected via bluetooth
    pin32 is permanently set to High. On disconnected state pin32 is permanently
    Low. I want to get some VB6 code to turn a LED On/Off/On (as often as I want).

    -Any idea how I can do this?

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    13,282

    Re: Bluetooth: connect/disconnect/connect a device

    It refers to it as a serial device which means you would use the MSComm control to talk to it.

    The picture is very misleading as it shows only 6 pins.

    In any case I would say that you should consult whatever documentation that you got with it.

    Also note that what triggers the LED to turn on or off may be internal and depend on a device actually being connected to it so you may not be able to toggle it through code.

    Question would be better suited if asked on the products site as from VB6 you are just talking about a comm port and the hardware beyond that is alien to VB6

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    130

    Re: Bluetooth: connect/disconnect/connect a device

    >>The picture is very misleading as it shows only 6 pins.
    Please visit the page
    http://www.ebay.com/itm/271513590642
    and then you see the green board has 6 pins and the small
    blue board on it (the bluetooth module itself) has 34pins.
    The pins are arranged as follows:
    Code:
    34-33-32-31-30-29-28-27-26-25-24-23-22
                                                       21
                                                       20
                                                       19
                                                       18
                                                       17
                                                       16
                                                       15
                                                       14
    01-02-03-04-05-06-07-08-09-10-11-12-13
    >>It refers to it as a serial device which means you
    >>would use the MSComm control to talk to it.
    I'm using VB since 14 years and I know what MSComm is. I do not need MSComm to set
    pin32 to High or Low. I just want to be able
    to connect and disconnect the Bluetooth module via VB6 code.
    If the module is connected ---> pin32 is High
    If disconnected ---> pin32 is Low
    -That's not an issue of MSComm.

    If pin32 is High or Low a garage door opens or gets closed via an optocoupler.
    Last edited by vb.elmar; Dec 13th, 2014 at 07:29 PM.

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    13,282

    Re: Bluetooth: connect/disconnect/connect a device

    Really? Well let me ask you this. How does it connect to the PC?

    It does not matter how many pins are on the chips it matters how many are exposed to the interface which appears to be 6.
    Is it in fact a serial device as the description indicates? If so then you use a method like you would a serial port i.e. MSComm or some third party tool if you prefer.

    Do you have documentation for the device?
    Does it provide a driver? An API?

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,437

    Re: Bluetooth: connect/disconnect/connect a device

    It looks like somebody has taken two small PC boards and soldered them together to work as one device.

    One of these appears to be some sort of RS-232 module with some minor "intelligence" on board. It appears to support an external RS-232 device that can pass data or "AT" commands. Some of the commands can be used to read the "Key" pin for input or switch sensing and write the "LED" pin for output. Then there is also some onboard firmware supporting a few more "AT" commands related to Bluetooth.

    These seem to come in master, slave, and master/slave varieties. This combined device seems to use the master/slave variation.

    The second part of this combo device appears to be a Bluetooth radio module designed to work with these RS-232 modules.


    So basically you take two of these buggers and use them as an "RS-232 cable over Bluetooth" along with some ability to fiddle with Key and LED lines. But there are only 6 lines (pins) meant to be used.

    All the rest appear to be used to interconnect the two boards, though I suppose it is possible to steal a few of them not used in this configuration and solder on wires and buffer circuits, assuming the on-board firmware supports them.


    To a PC I suspect this just looks like a weird external RS-232 device, which would be connected via a COMx: port. So to VB6 it is merely another thing to talk to with MSComm.


    It looks pretty darned boring to me. I doubt anyone is going to try to work through all of the broken English, German, Chinese, etc. involved to track down and analyze the spec sheets in order to write sample VB6 code to send the necessary "AT" commands to invoke the extra features this provides beyond being a virtual RS-232 cable over Bluetooth.

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